From 1cac2f5d3261a3d1d9f660d9ca8489858a04a2d3 Mon Sep 17 00:00:00 2001 From: Johan Mast Date: Tue, 3 Feb 2026 18:42:32 +0100 Subject: [PATCH 1/2] update scalac-options to support Scala 3.8.x --- README.md | 4 ++-- build.sbt | 2 +- .../davidgregory084/TpolecatPlugin.scala | 2 +- .../modePerConfiguration/build.sbt | 12 +++++----- .../sbt-tpolecat/scalacOptions/build.sbt | 22 ++++++++++--------- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index b9dc42e..90661ae 100644 --- a/README.md +++ b/README.md @@ -122,9 +122,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 warnings option (`-Xfatal-warnings` ) is added. +In this mode all development mode options are enabled, and the fatal warnings option (`-Xfatal-warnings` or `-Werror`, depending on the Scala version ) is added. -You can customise the options that are enabled in this mode by modifying the `tpolecatCiModeOptions` key. Default: `tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings`. +You can customise the options that are enabled in this mode by modifying the `tpolecatCiModeOptions` key. Default: `tpolecatDevModeOptions.value + ScalacOptions.fatalWarningsOptions`. For example, to disable unused linting you could customise the CI options as follows: diff --git a/build.sbt b/build.sbt index d8c4273..fc60718 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ lazy val `sbt-tpolecat-plugin` = project Test / headerCreate := { (Test / headerCreate).triggeredBy(Test / compile).value }, scalacOptions += "-Xlint:unused", libraryDependencies ++= Seq( - "org.typelevel" %% "scalac-options" % "0.1.8", + "org.typelevel" %% "scalac-options" % "0.1.9", "org.scalatest" %% "scalatest" % "3.2.19" % Test, "org.scalacheck" %% "scalacheck" % "1.18.1" % Test, "org.scalatestplus" %% "scalacheck-1-16" % "3.2.14.0" % Test diff --git a/plugin/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala b/plugin/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala index 7c1760a..4409b60 100644 --- a/plugin/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala +++ b/plugin/src/main/scala/io/github/davidgregory084/TpolecatPlugin.scala @@ -205,7 +205,7 @@ object TpolecatPlugin extends AutoPlugin { tpolecatVerboseModeOptions := tpolecatDevModeOptions.value ++ ScalacOptions.verboseOptions ), Def.derive( - tpolecatCiModeOptions := tpolecatDevModeOptions.value + ScalacOptions.fatalWarnings + tpolecatCiModeOptions := tpolecatDevModeOptions.value ++ ScalacOptions.fatalWarningOptions ), Def.derive( tpolecatReleaseModeOptions := tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal diff --git a/plugin/src/sbt-test/sbt-tpolecat/modePerConfiguration/build.sbt b/plugin/src/sbt-test/sbt-tpolecat/modePerConfiguration/build.sbt index deda3ac..e0b966b 100644 --- a/plugin/src/sbt-test/sbt-tpolecat/modePerConfiguration/build.sbt +++ b/plugin/src/sbt-test/sbt-tpolecat/modePerConfiguration/build.sbt @@ -25,15 +25,15 @@ Compile / tpolecatOptionsMode := CiMode Test / tpolecatOptionsMode := DevMode TaskKey[Unit]("checkCompileOptions") := { - val hasFatalWarnings = - scalacOptions.value.contains("-Xfatal-warnings") + val options = scalacOptions.value + val hasFatalWarningsOrWarnError = options.contains("-Xfatal-warnings") || options.contains("-Werror") - assert(hasFatalWarnings) + assert(hasFatalWarningsOrWarnError) } TaskKey[Unit]("checkTestOptions") := { - val hasFatalWarnings = - (Test / scalacOptions).value.contains("-Xfatal-warnings") + val options = (Test / scalacOptions).value + val hasFatalWarningsOrWarnError = options.contains("-Xfatal-warnings") || options.contains("-Werror") - assert(!hasFatalWarnings) + assert(!hasFatalWarningsOrWarnError) } diff --git a/plugin/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt b/plugin/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt index 93e68bc..f469561 100644 --- a/plugin/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt +++ b/plugin/src/sbt-test/sbt-tpolecat/scalacOptions/build.sbt @@ -277,11 +277,11 @@ TaskKey[Unit]("checkCiMode") := { val expectedOptions = scalaV match { case Scala211 => Scala211Options ++ Seq("-Xfatal-warnings") case Scala212 => Scala212Options ++ Seq("-Xfatal-warnings") - case Scala213 => Scala213Options ++ Seq("-Xfatal-warnings") - case Scala30 => Scala30Options ++ Seq("-Xfatal-warnings") - case Scala31 => Scala31Options ++ Seq("-Xfatal-warnings") - case Scala33 => Scala33Options ++ Seq("-Xfatal-warnings") - case Scala331 => Scala331Options ++ Seq("-Xfatal-warnings") + case Scala213 => Scala213Options ++ Seq("-Werror") + case Scala30 => Scala30Options ++ Seq("-Werror") + case Scala31 => Scala31Options ++ Seq("-Werror") + case Scala33 => Scala33Options ++ Seq("-Werror") + case Scala331 => Scala331Options ++ Seq("-Werror") } val actualOptions = scalacOptions.value @@ -294,6 +294,8 @@ TaskKey[Unit]("checkReleaseMode") := { val fatalWarnings = Seq("-Xfatal-warnings") + val warnError = Seq("-Werror") + val optimizerMethodLocal = Seq("-opt:l:method") val optimizerInline = Seq( @@ -316,14 +318,14 @@ TaskKey[Unit]("checkReleaseMode") := { "8" ) case Scala213 => - Scala213Options ++ fatalWarnings ++ optimizerMethodLocal ++ releaseOptions ++ optimizerInline ++ Seq( + Scala213Options ++ warnError ++ optimizerMethodLocal ++ releaseOptions ++ optimizerInline ++ Seq( "-Ybackend-parallelism", "8" ) - case Scala30 => Scala30Options ++ fatalWarnings ++ releaseOptions - case Scala31 => Scala31Options ++ fatalWarnings ++ releaseOptions - case Scala33 => Scala33Options ++ fatalWarnings ++ releaseOptions - case Scala331 => Scala331Options ++ fatalWarnings ++ releaseOptions + case Scala30 => Scala30Options ++ warnError ++ releaseOptions + case Scala31 => Scala31Options ++ warnError ++ releaseOptions + case Scala33 => Scala33Options ++ warnError ++ releaseOptions + case Scala331 => Scala331Options ++ warnError ++ releaseOptions } val actualOptions = scalacOptions.value From 0c73dbab9c50eb698155a5f786cd63db494df94c Mon Sep 17 00:00:00 2001 From: Johan Mast Date: Wed, 4 Feb 2026 11:57:38 +0100 Subject: [PATCH 2/2] fix typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90661ae..780ad65 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ To enable the continuous integration mode, use the `tpolecatCiMode` command or d In this mode all development mode options are enabled, and the fatal warnings option (`-Xfatal-warnings` or `-Werror`, depending on the Scala version ) is added. -You can customise the options that are enabled in this mode by modifying the `tpolecatCiModeOptions` key. Default: `tpolecatDevModeOptions.value + ScalacOptions.fatalWarningsOptions`. +You can customise the options that are enabled in this mode by modifying the `tpolecatCiModeOptions` key. Default: `tpolecatDevModeOptions.value + ScalacOptions.fatalWarningOptions`. For example, to disable unused linting you could customise the CI options as follows: