如何在sbt构建期间跳过Scalastyle?

时间:2018-03-21 08:09:53

标签: sbt scalastyle

是否可以使用命令行参数运行sbt构建并仅为此次运行禁用Scalastyle?

我正在考虑与Checkstyle相似的东西(使用Maven)-Dcheckstyle.skip=true,但似乎在Scalastyle文档中找不到类似内容。

更新 - sbt& scalastyle config:

build.sbt中的Scalastyle配置:

// add scalastyle to compile task
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
compileScalastyle := scalastyle.in(Compile).toTask("").value
(compile in Compile) := ((compile in Compile) dependsOn compileScalastyle).value

// add scalastyle to test task
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
testScalastyle := scalastyle.in(Test).toTask("").value
(test in Test) := ((test in Test) dependsOn testScalastyle).value

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

scalastyle-config.xml(和scalastyle-test-config.xml):

<?xml version="1.0" standalone="no" ?>
<!DOCTYPE scalastyle [
    <!ENTITY baseRules SYSTEM "scalastyle-base-rules.xml">
    ]>
<scalastyle>
    <name>Scalastyle standard configuration</name>

    <!-- <check> elements, omitted for brevity -->

</scalastyle>

0 个答案:

没有答案