3

里面的scalastyle配置build.sbt设置如下:

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


然而,sbt "it:scalastyle"不会检查/src/it目录中的源文件。该命令只是忽略it并检查/src/main目录中的源。

sbt "test:scalastyle"工作正常。

关于如何解决此问题的任何想法?

更新:删除配置后build.sbt,我仍然可以使用test:scalastyle但不能使用it:scalastyle

4

1 回答 1

2

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

于 2017-09-07T02:19:40.727 回答