1

I have the following in my build.sbt for setting up scalastyle to run on compilation. It works except that it produces duplicate errors on the same line.

lazy val scalaStyleOnCompileTask = taskKey[Unit]("scalaStyleOnCompileTask")

scalaStyleOnCompileTask := scalastyle.in(Compile).toTask("").value
(Compile / compile) := (Compile / compile).dependsOn(scalaStyleOnCompileTask).value

The scalastyle check rule does not really matter but take the built-in ones for example:

<check level="error" class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true"/>

<check level="error" class="org.scalastyle.scalariform.NullChecker" enabled="true"/>

So I get two errors for the same line.

[info] scalastyle using config .../scalastyle-config.xml
[error] .../BusinessLogic.scala:15:14: Usage of ??? operator
[error] .../BusinessLogic.scala:15:14: Usage of ??? operator

When I run the check on the command line using scalastyle -c scalastyle-config.xml ., error is reported only once.

Why is this happening? Help appreciated

Higher-Kinded Type
  • 1,964
  • 5
  • 27
  • 44

0 Answers0