Closed mthurlin closed 7 years ago
By default the sbt plugin uses the normal scalaSource setting. There isn't a way to exclude a particular set of directories at the minute.
+1
Does this commit improve this?
https://github.com/scalastyle/scalastyle-sbt-plugin/commit/313833043d734b974869c6d3f7f13d6a56a0b050
+1 would like to see this feature.
[edit] look like its implemented in oct 2015 https://github.com/scalastyle/scalastyle/blob/e19b54eacb6502b47b1f84d7b2a6b5d33f3993bc/src/main/scala/org/scalastyle/Main.scala#L51 , but i am not able to figure out how to use in maven plugin.
This should be fixed. You can now supply a list of files to scalastyleSources. This should be available to test in 0.9.0-SNAPSHOT. Closing issue.
if use play framework,you can try this:
lazy val root = (project in file(".")).enablePlugins(PlayScala).
settings(
(scalastyleSources in Compile) := {
val scalaSourceFiles = ((scalaSource in Compile).value ** "*.scala").get
scalaSourceFiles.filterNot(_.getAbsolutePath.contains("example.scala")).filterNot(_.getAbsolutePath.contains("somefolder"))
}
)
if use play framework,you can try this:
lazy val root = (project in file(".")).enablePlugins(PlayScala). settings( (scalastyleSources in Compile) := { val scalaSourceFiles = ((scalaSource in Compile).value ** "*.scala").get scalaSourceFiles.filterNot(_.getAbsolutePath.contains("example.scala")).filterNot(_.getAbsolutePath.contains("somefolder")) } )
When using the above you code in your build.sbt
might run into the error.
warning: method in in trait ScopingSetting is deprecated (since 1.5.0): `in` is deprecated; migrate to slash
Updated way to do it is.
(Compile / scalastyleSources) := {
val scalaSourceFiles = ((Compile / scalaSource).value ** "*.scala").get
scalaSourceFiles.filterNot(_.getAbsolutePath.contains("example.scala")).filterNot(_.getAbsolutePath.contains("somefolder"))
},
This worked with the sbt plugin
.
I would like to exclude some folders/files from being checked, how do I do that?
The command-line version of scalastyle takes the source directory to use, but I can't figure out how to do that with scalastyle-sbt.