Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Add a predefined constant for non exhaustive match pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
kciesielski committed Mar 14, 2019
1 parent 0e6b5b1 commit 6829f56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Expand Up @@ -21,7 +21,7 @@ name := "clippy"
// factor out common settings into a sequence
lazy val commonSettingsNoScalaVersion = Seq(
organization := "com.softwaremill.clippy",
version := "0.6.0",
version := "0.6.1",
scalacOptions ++= Seq("-unchecked", "-deprecation"),
parallelExecution := false,
// Sonatype OSS deployment
Expand Down
Expand Up @@ -26,6 +26,10 @@ object ClippySbtPlugin extends AutoPlugin {
val None = Value("none")
}

object WarningPatterns {
val NonExhaustiveMatch = "match may not be exhaustive[\\s\\S]*"
}

object autoImport {
val clippyColorsEnabled = settingKey[Boolean]("Should Clippy color type mismatch diffs and highlight syntax")
val clippyColorDiff = settingKey[Option[ClippyColor.Value]]("The color to use for diffs, if other than default")
Expand All @@ -45,6 +49,7 @@ object ClippySbtPlugin extends AutoPlugin {
settingKey[Option[String]]("Project root in which project-specific advice is stored, if any")
val clippyFatalWarnings =
settingKey[List[String]]("Regular expressions of warning messages which should fail compilation")
val NonExhaustiveMatch = "match may not be exhaustive[\\s\\S]*"
}

// in ~/.sbt auto import doesn't work, so providing aliases here for convenience
Expand Down
10 changes: 6 additions & 4 deletions ui/app/views/use.scala.html
Expand Up @@ -29,7 +29,7 @@ <h2>Adding the plugin</h2>
</p>

<pre>
addSbtPlugin("com.softwaremill.clippy" % "plugin-sbt" % "0.6.0")
addSbtPlugin("com.softwaremill.clippy" % "plugin-sbt" % "0.6.1")
</pre>

<p>
Expand Down Expand Up @@ -58,9 +58,11 @@ <h2>(NEW!) Turning selected compilation warnings into errors</h2>
use the <code>clippyFatalWarnings</code> setting, for example:
</p>
<pre>
import com.softwaremill.clippy.ClippySbtPlugin.WarningPatterns._
// ...
settings(
clippyFatalWarnings ++= List(
"match may not be exhaustive[\\s\\S]*",
NonExhaustiveMatch,
".*\\[wartremover:.*\\].*[\\s\\S]*"
)
)
Expand Down Expand Up @@ -175,15 +177,15 @@ <h2>Alternative ways to use Clippy</h2>
</p>

<pre>
addCompilerPlugin("com.softwaremill.clippy" %% "plugin" % "0.6.0" classifier "bundle")
addCompilerPlugin("com.softwaremill.clippy" %% "plugin" % "0.6.1" classifier "bundle")
</pre>

<p>
If you are using <code>scalac</code> directly, add the following option:
</p>

<pre>
-Xplugin:clippy-plugin_2.11-0.6.0-bundle.jar
-Xplugin:clippy-plugin_2.11-0.6.1-bundle.jar
</pre>

<p>
Expand Down

0 comments on commit 6829f56

Please sign in to comment.