Business Studies, asked by rabeeamasood2515, 1 year ago

How to ensure build will break if there will be scalstyle warnings in sbt project

Answers

Answered by xtylishbabu
0

Answer:

// scalastyle check

lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")

compileScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Compile).toTask("").value

(compile in Compile) <<= (compile in Compile) dependsOn compileScalastyle

in project/plugins.sbt:

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")

When I run sbt compile, scalastyle is generating [warning] ***./utils/ConfigManager.scala: File must end with newline character, but compile still succeeded.

Is there a way to make sbt compile fail on scalastyle warnings?

I just change all <check level="warning" ...> to be <check level="error" ...> in scalastyleGenerateConfig, I'm not sure this is the right way to do it.

Explanation:

Answered by UrvashiBaliyan
0

Answer:

// scalastyle check

lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")

compileScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Compile).toTask("").value

(compile in Compile) <<= (compile in Compile) dependsOn compileScalastyle

in project/plugins.sbt:

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")

When I run sbt compile, scalastyle is generating [warning] ***./utils/ConfigManager.scala: File must end with newline character, but compile still succeeded.

Is there a way to make sbt compile fail on scalastyle warnings?

I just change all <check level="warning" ...> to be <check level="error" ...> in scalastyleGenerateConfig, I'm not sure this is the right way to do it.

Similar questions