it:scalastyle not working for integration tests' folder

602 Views Asked by At

The scalastyle configuration in build.sbt is set as follows:

(scalastyleConfig in Test) := baseDirectory.value / "scalastyle-config.xml"
(scalastyleConfig in IntegrationTest) := baseDirectory.value / "scalastyle-config.xml"


Nevertheless, the sbt "it:scalastyle" does not check the source files in the /src/it directory. This command just ignores the it and checks the sources in the /src/main directory.

sbt "test:scalastyle" works fine.

Any idea on how I can fix this issue?

Update: After I remove the configurations in the build.sbt, I am still able to use test:scalastyle but not it:scalastyle.

1

There are 1 best solutions below

1
On

Assuming you use lazy val IntegrationTest= config("it") extend Test to define it ,then you can use the following code which just modified from the plugin's source code.

Project.inConfig(IntegrationTest)(rawScalastyleSettings())

(scalastyleConfig in IntegrationTest) := (scalastyleConfig in Test).value

(scalastyleConfigUrl in IntegrationTest) := None

(scalastyleConfigRefreshHours in IntegrationTest) := (scalastyleConfigRefreshHours in Test).value

(scalastyleTarget in IntegrationTest) := target.value / "scalastyle-it-result.xml"

(scalastyleFailOnError in IntegrationTest) := (scalastyleFailOnError in Test).value

(scalastyleSources in IntegrationTest) := Seq((scalaSource in IntegrationTest).value)

Relevant Github issue: Github issue: https://github.com/scalastyle/scalastyle-sbt-plugin/issues/64