有没有更好的方法在 IntelliJ 下设置 ScalaStyle?

Is there a better way to setup ScalaStyle under IntelliJ?

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) 中有一些 scalastyle 支持。

目前,要让 IntelliJ 中的 scalastyle 插件获取我们的 scalastyle 配置,您需要将其副本放入 .idea 文件夹(据说 .project 也可以,但我没有'测试了这个)。此外,该文件需要命名为 scalastyle_config.xml(使用下划线而不是连字符)。简而言之,您需要在项目的根目录中调用以下内容:

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

虽然我认为这是一个丑陋的 hack,但它至少让我在构建整个项目之前看到了 scalastyle 违规行为。如果您对此有更好的解决方案,请告诉我。

我发现如果您使用的是 IntelliJ 15 并更新 Scala 插件,这现在可以工作了。

该插件已于 10 月 12 日更新,以支持位于项目根目录或 .idea 目录中的配置文件。配置文件现在可以用下划线或连字符命名。