Skip to content

Commit

Permalink
Set up Scalafix
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown committed Mar 11, 2020
1 parent 21d49b4 commit 4f6d5c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
22 changes: 7 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ lazy val scoverageSettings = Seq(
)

organization in ThisBuild := "org.typelevel"
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.1.0"

val isTravisBuild = settingKey[Boolean]("Flag indicating whether the current build is running under Travis")
val crossScalaVersionsFromTravis = settingKey[Seq[String]]("Scala versions set in .travis.yml as scala_version_XXX")
Expand Down Expand Up @@ -67,13 +68,7 @@ lazy val commonSettings = commonScalaVersionSettings ++ Seq(
) ++ warnUnusedImport

def macroDependencies(scalaVersion: String) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, minor)) if minor < 13 =>
Seq(
compilerPlugin(("org.scalamacros" %% "paradise" % "2.1.1").cross(CrossVersion.patch))
)
case _ => Seq()
}
Seq("org.scala-lang" % "scala-reflect" % scalaVersion % Provided)

lazy val catsSettings = Seq(
incOptions := incOptions.value.withLogRecompileOnMacro(false),
Expand All @@ -83,10 +78,9 @@ lazy val catsSettings = Seq(
) ++ commonSettings ++ publishSettings ++ scoverageSettings ++ simulacrumSettings

lazy val simulacrumSettings = Seq(
libraryDependencies ++= Seq(
scalaOrganization.value % "scala-reflect" % scalaVersion.value % Provided,
"org.typelevel" %%% "simulacrum" % "1.0.0" % Provided
),
addCompilerPlugin(scalafixSemanticdb),
scalacOptions ++= Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos"),
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.1.0",
pomPostProcess := { (node: xml.Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] = node match {
Expand Down Expand Up @@ -216,7 +210,7 @@ lazy val docSettings = Seq(
) ++ (if (priorTo2_13(scalaVersion.value))
Seq("-Yno-adapted-args")
else
Seq("-Ymacro-annotations")),
Nil),
scalacOptions in Tut ~= (_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports", "-Ywarn-dead-code"))),
git.remoteRepo := "[email protected]:typelevel/cats.git",
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md" | "*.svg",
Expand Down Expand Up @@ -795,9 +789,7 @@ def commonScalacOptions(scalaVersion: String) =
"-Xfuture"
)
else
Seq(
"-Ymacro-annotations"
))
Nil)

def priorTo2_13(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.32")

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.11")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("com.github.gseitz" %% "sbt-release" % "1.0.13")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
Expand Down

0 comments on commit 4f6d5c2

Please sign in to comment.