How to enable scala linter?

I added in my build.sbt file directed :

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

Now what? I can compile my project as usual, but I see no way out of linter. Is there a special sbt task that I need to run?

+4
source share
1 answer

From the 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>

However, it worked for me by simply adding the compiler plugin as you did. A simple way to test is this method:

def f(a: Int) = 10

You should get a warning that looks like this:

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

Source: https://habr.com/ru/post/1652371/


All Articles