Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a better way to setup ScalaStyle under IntelliJ?

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.

like image 387
Francois G Avatar asked Nov 02 '15 10:11

Francois G


People also ask

How do I add Scala support to IntelliJ?

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.

What is Scala style?

Scalastyle is used as part of the grading framework for the course Functional Programming Principles in Scala by Martin Odersky on Coursera.


1 Answers

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.

like image 60
darrenmc Avatar answered Sep 20 '22 14:09

darrenmc