scalastyle / scalastyle-sbt-plugin

scalastyle-sbt-plugin
Apache License 2.0
139 stars 52 forks source link

`failOnError` setting #10

Closed RishatShamsutdinov closed 11 years ago

RishatShamsutdinov commented 11 years ago

fail on error logic (need for compile && scalastyle tasks)

matthewfarwell commented 11 years ago

This is great. For the documentation could you give me a use case?

RishatShamsutdinov commented 11 years ago

Yep. We have a strong rules for code style and before pushing to the git repo we have to run something likes this: sbt compile && sbt scalastyle && git push

matthewfarwell commented 11 years ago

Cool. Thanks.

pathikrit commented 10 years ago

Sorry basic question - How do I use this key in my build.sbt?

Currently I just have one line: org.scalastyle.sbt.ScalastylePlugin.Settings

Also is it possible to make the compile task depend on scalstyle? That way I can just always use compile and know that compilation will fail if I violated our style guide?

RishatShamsutdinov commented 10 years ago

Build.scala example:

val scalaStyleSettings = org.scalastyle.sbt.ScalastylePlugin.Settings
val sCompile = InputKey[Unit]("scompile") in Compile

val buildSettings = Defaults.defaultSettings ++ scalaStyleSettings ++ ... ++ Seq(
  sCompile <<= org.scalastyle.sbt.PluginKeys.scalastyle dependsOn (compile in Compile)
)

scompile will fail if you violated your style guide.