2016-08-24 37 views
4

我加入到我的build.sbt为directed如何启用scala linter?

addCompilerPlugin("org.psywerx.hairyfotr" %% "linter" % "0.1.14") 

现在怎么办?我可以照常编译我的项目,但没有看到任何来自linter的输出。我需要运行一项特殊的任务吗?

回答

5

从他们documentation

terminal: 
    scalac -Xplugin:<path-to-linter-jar>.jar ... 

sbt: (in build.sbt) 
    scalacOptions += "-Xplugin:<path-to-linter-jar>.jar" 

maven: (in pom.xml inside scala-maven-plugin configuration) 
    <configuration> 
    <args> 
     <arg>-Xplugin:<path-to-linter-jar>.jar</arg> 
    </args> 
    </configuration> 

但是,对我来说它的工作通过简单地将编译器插件,你所做的一切。一个简单的方法来测试是把一个方法,像这样的地方:

def f(a: Int) = 10 

你应该看起来像这样的警告:

Parameter a is not used in method f. 
[warn] def f(a: Int) = 10 
[warn]  ^