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

Add and configure sbt-wartremover #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ addSbtPlugin("com.dwijnand" % "sbt-dynver" % "3.0.0")
addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.1.1")
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.6.0-RC3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.2.1")


scalafmtOnCompile := true
scalafmtConfig := Some(baseDirectory.value / "src" / "main" / "resources" / "scalafmt.conf")

1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
libraryDependencies += { "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value }
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.6.0-RC3")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.2.1")
5 changes: 3 additions & 2 deletions src/main/scala/ScalazPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import sbt._
import Keys._
import de.heikoseeberger.sbtheader.HeaderPlugin
import org.scalafmt.sbt.ScalafmtPlugin
import wartremover.WartRemover

object ScalazPlugin extends AutoPlugin {

override def trigger = allRequirements

override def requires = HeaderPlugin && ScalafmtPlugin
override def requires = HeaderPlugin && ScalafmtPlugin && WartRemover

override def buildSettings =
Compilation.buildSettings ++
Expand All @@ -25,5 +26,5 @@ object ScalazPlugin extends AutoPlugin {
)

override def projectSettings =
Compilation.projectSettings
Compilation.projectSettings ++ WartRemoverSettings.buildSettings
}
12 changes: 12 additions & 0 deletions src/main/scala/WartRemoverSettings.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package scalaz.build
import sbt.Keys._
import sbt._
import wartremover.WartRemover.autoImport.wartremoverErrors
import wartremover.Wart

object WartRemoverSettings {

val buildSettings = Seq(
wartremoverErrors in (Compile, compile) += Wart.Nothing
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.1.6
6 changes: 6 additions & 0 deletions src/sbt-test/scalaz-sbt/wartremover/project/test.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
val pluginVersion =
sys.props
.get("plugin.version")
.getOrElse(sys.error("Sys prop plugin.version must be defined!"))

addSbtPlugin("org.scalaz" % "scalaz-sbt" % pluginVersion)
3 changes: 3 additions & 0 deletions src/sbt-test/scalaz-sbt/wartremover/src/main/scala/Test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Test {
def foo(a: String, b: Int): String = b + a
}
4 changes: 4 additions & 0 deletions src/sbt-test/scalaz-sbt/wartremover/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Verify that the sbt-wartremover plugin is correctly activated

> clean
-> compile
6 changes: 6 additions & 0 deletions src/sbt-test/scalaz-sbt/wartremover/test.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lazy val app = project
.in(file("."))
.settings(
name := "wartremover",
wartremoverErrors in (Compile, compile) ++= Warts.all
).enablePlugins(ScalazPlugin)