From ed5705060810c722385097c3eef8b44ee193eec0 Mon Sep 17 00:00:00 2001 From: David Gregory Date: Wed, 30 Mar 2022 15:08:09 +0100 Subject: [PATCH] Make -Xfatal-warnings a universal option again --- README.md | 4 ++-- src/main/scala/io/github/davidgregory084/ScalacOptions.scala | 2 +- src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala | 2 +- src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ee4f99e..738d00a 100644 --- a/README.md +++ b/README.md @@ -67,9 +67,9 @@ You can customise the environment variable that is used to enable this mode by m To enable the continuous integration mode, use the `tpolecatCiMode` command or define the environment variable `SBT_TPOLECAT_CI`. -In this mode all development mode options are enabled, and the fatal warning options (`-Xfatal-warnings` / `-Werror`) are added as appropriate for your Scala version. +In this mode all development mode options are enabled, and the fatal warnings option (`-Xfatal-warnings` ) is added. -You can customise the options that are enabled in this mode by modifying the `tpolecatCiModeOptions` key. Default: `tpolecatDevModeOptions.value ++ ScalacOptions.fatalWarningOptions`. +You can customise the options that are enabled in this mode by modifying the `tpolecatCiModeOptions` key. Default: `tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings`. For example, to disable unused linting you could customise the CI options as follows: diff --git a/src/main/scala/io/github/davidgregory084/ScalacOptions.scala b/src/main/scala/io/github/davidgregory084/ScalacOptions.scala index 5a0a477..9e4ba60 100644 --- a/src/main/scala/io/github/davidgregory084/ScalacOptions.scala +++ b/src/main/scala/io/github/davidgregory084/ScalacOptions.scala @@ -94,7 +94,7 @@ trait ScalacOptions { /** Fail the compilation if there are any warnings. */ val fatalWarnings = - advancedOption("fatal-warnings", version => version < V2_13_0 || version >= V3_0_0) + advancedOption("fatal-warnings") /** Enable recommended warnings. */ diff --git a/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala b/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala index 50c1fc8..bef623f 100644 --- a/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala +++ b/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala @@ -130,7 +130,7 @@ object TpolecatPlugin extends AutoPlugin { override def projectSettings: Seq[Setting[_]] = Seq( scalacOptions := scalacOptionsFor(scalaVersion.value, tpolecatScalacOptions.value), tpolecatDevModeOptions := ScalacOptions.default, - tpolecatCiModeOptions := tpolecatDevModeOptions.value ++ ScalacOptions.fatalWarningOptions, + tpolecatCiModeOptions := tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings, tpolecatReleaseModeOptions := tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal, tpolecatScalacOptions := { (ThisBuild / tpolecatOptionsMode).value match { diff --git a/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt b/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt index ed4c23b..36da756 100644 --- a/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt +++ b/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt @@ -191,7 +191,7 @@ TaskKey[Unit]("checkCiMode") := { val expectedOptions = scalaV match { case Scala211 => Scala211Options ++ Seq("-Xfatal-warnings", "-Ypartial-unification") case Scala212 => Scala212Options ++ Seq("-Xfatal-warnings", "-Ypartial-unification") - case Scala213 => Scala213Options ++ Seq("-Werror") + case Scala213 => Scala213Options ++ Seq("-Xfatal-warnings") case Scala30 => Scala30Options ++ Seq("-Xfatal-warnings") case Scala31 => Scala31Options ++ Seq("-Xfatal-warnings") } @@ -220,7 +220,7 @@ TaskKey[Unit]("checkReleaseMode") := { ) case Scala213 => Scala213Options ++ Seq( - "-Werror", + "-Xfatal-warnings", "-opt:l:method", "-opt:l:inline", "-opt-inline-from:**"