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.
To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.
Scalastyle is used as part of the grading framework for the course Functional Programming Principles in Scala by Martin Odersky on Coursera.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With