All the other questions I've found on this topic are quite old.
I am building a scala project with sbt
and the scala-style
plugin but I can't find a way to exclude a specific folder where I have some generated code.
Is there a way to force the plugin to not check that particular folder?
Right now I am editing the files manually and adding:
// scalastyle:off
on the top of the file, but this is quite annoying.
In the official website http://www.scalastyle.org/sbt.html I couldn't find any documentation, although it seems that it is actually possible to exclude paths/files from it.
so it seems that we can actually pass:
println(" -x, --excludedFiles STRING regular expressions to exclude file paths (delimited by semicolons)")
In my build.sbt
I call:
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
compileScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Compile).toTask("").value
(compile in Compile) <<= (compile in Compile) dependsOn compileScalastyle
Is there a way to achieve that with the sbt plugin
?
You could get all files/directories under "src/main/scala" and filter out your directory:
EDIT:
I've added a more "generic" solution where it checks the path of each file to exclude...