Is there a better way to setup ScalaStyle under IntelliJ?
Asked Answered
L

1

17

There's some scalastyle support in the Scala plugin for IntelliJ. This question is about the best way to set it up to pick up a scalastyle configuration file which is customarily at the root of the directory under the name scalastyle-config.xml (example for the Spark project).

Currently, to get the scalastyle plugin in IntelliJ to pickup our scalastyle config, you need to put a copy of it into your .idea folder (supposedly .project would also work, but I haven’t tested this). Also, the file needs to be named scalastyle_config.xml (with an underscore instead of the hyphen). In short, you need to call the following in the root of your project:

cp scalastyle-config.xml .idea/scalastyle_config.xml

While I think this is an ugly hack, it at least allows me to see the scalastyle violations before building the whole project. Please let me know if you have a better solution for this.

Lalita answered 2/11, 2015 at 10:14 Comment(1)
I seem to be getting away with linking the file IntelliJ wants (scalastyle_config.xml) to the one sbt wants (scalastyle-config.xml).Parathion
A
12

I have found that this now works if you are using IntelliJ 15 and update the Scala plugin.

The plugin was updated on October 12 to support the configuration file located in either the project root or .idea directory. The configuration file now can be named with an underscore or a hyphen.

Archibold answered 3/12, 2015 at 22:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.