From 06b018809ecaa3380f934c819262f671785bae0e Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Sun, 8 Dec 2024 12:30:25 -0800 Subject: [PATCH 1/5] SBT: treat warnings as errors --- build.sbt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.sbt b/build.sbt index a7c77e5..8ba2d84 100644 --- a/build.sbt +++ b/build.sbt @@ -84,6 +84,15 @@ lazy val sharedSettings = Def.settings( else "-Ywarn-unused-import" }, scalacOptions += "-deprecation", + scalacOptions += "-Xfatal-warnings", + scalacOptions ++= { + if (isScala213.value) "-Wconf:cat=deprecation:is" :: Nil + else if (isScala3.value) "-Wconf:cat=deprecation:silent" :: Nil + else Nil + }, + scalacOptions ++= { + if (isScala3.value) Nil else "-Wconf:cat=feature:is" :: Nil + }, mimaBinaryIssueFilters += languageAgnosticCompatibilityPolicy, crossScalaVersions := ScalaVersions, scalaVersion := scala213, From 636d9890b6ce215c2b5766bb9c45c869067595e9 Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Tue, 17 Dec 2024 18:54:52 +0100 Subject: [PATCH 2/5] bugfix: Fix errors after setting fatal warnings --- build.sbt | 3 +++ .../src/main/scala-3/metaconfig/pprint/TPrintImpl.scala | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 8ba2d84..f6a2f0a 100644 --- a/build.sbt +++ b/build.sbt @@ -217,6 +217,9 @@ lazy val docs = project.in(file("metaconfig-docs")).settings( "org.scalameta" %%% "munit-scalacheck" % V.munit % Test, ), publish / skip := true, + dependencyOverrides += + "org.scalameta" %% "metaconfig-typesafe-config" % (ThisBuild / version) + .value, moduleName := "metaconfig-docs", mdocVariables := Map( "VERSION" -> version.value.replaceFirst("\\+.*", ""), diff --git a/metaconfig-pprint/shared/src/main/scala-3/metaconfig/pprint/TPrintImpl.scala b/metaconfig-pprint/shared/src/main/scala-3/metaconfig/pprint/TPrintImpl.scala index 710b2f0..6934f0e 100644 --- a/metaconfig-pprint/shared/src/main/scala-3/metaconfig/pprint/TPrintImpl.scala +++ b/metaconfig-pprint/shared/src/main/scala-3/metaconfig/pprint/TPrintImpl.scala @@ -124,10 +124,10 @@ object TPrintLowPri { val pre = rec(tpe) lazy val defs = fansi.Str.join( refinements.collect { - case (name, tpe: TypeRepr) => fansi.Str("type " + name + " = ") ++ - rec(tpe) case (name, TypeBounds(lo, hi)) => fansi.Str("type " + name) ++ printBounds(lo, hi) ++ rec(tpe) + case (name, tpe: TypeRepr) => fansi.Str("type " + name + " = ") ++ + rec(tpe) }, sep = "; ", ) From 06e9e93bcebf76bdcae3ded132eab63dd8b30fcf Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Wed, 18 Dec 2024 10:30:18 +0100 Subject: [PATCH 3/5] bugfix: Fix Scala 3 warning for pattern in value --- .../src/test/scala/metaconfig/ConfDynamicSuite.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala b/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala index 75994a0..0a35a9c 100644 --- a/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala +++ b/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala @@ -1,4 +1,6 @@ package metaconfig +import metaconfig.Configured.NotOk +import metaconfig.Configured.Ok class ConfDynamicSuite extends munit.FunSuite { @@ -19,7 +21,10 @@ class ConfDynamicSuite extends munit.FunSuite { assert(conf.dynamic.x.c.d.e.asConf.isNotOk) } test("did you mean?") { - val Configured.NotOk(err) = conf.dynamic.banna.asConf - assert(err.toString.contains("Did you mean 'banana'")) + conf.dynamic.banna.asConf match { + case NotOk(err) => + assert(err.toString.contains("Did you mean 'banana'")) + case Ok(value) => fail("Expected \"Did you mean 'banana'\" error") + } } } From b002a4e92fac03f16b65c1c7c57cc30a81c1d50b Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Wed, 18 Dec 2024 11:58:25 +0100 Subject: [PATCH 4/5] chore: Run scalafmt --- .../shared/src/test/scala/metaconfig/ConfDynamicSuite.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala b/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala index 0a35a9c..cd6f8af 100644 --- a/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala +++ b/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala @@ -22,8 +22,7 @@ class ConfDynamicSuite extends munit.FunSuite { } test("did you mean?") { conf.dynamic.banna.asConf match { - case NotOk(err) => - assert(err.toString.contains("Did you mean 'banana'")) + case NotOk(err) => assert(err.toString.contains("Did you mean 'banana'")) case Ok(value) => fail("Expected \"Did you mean 'banana'\" error") } } From c6a943907a5d344e43b5fa71e412d5880682c5b7 Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Wed, 18 Dec 2024 12:36:41 +0100 Subject: [PATCH 5/5] minor: Apply review comments --- .../src/test/scala/metaconfig/ConfDynamicSuite.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala b/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala index cd6f8af..790bd26 100644 --- a/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala +++ b/metaconfig-tests/shared/src/test/scala/metaconfig/ConfDynamicSuite.scala @@ -1,6 +1,4 @@ package metaconfig -import metaconfig.Configured.NotOk -import metaconfig.Configured.Ok class ConfDynamicSuite extends munit.FunSuite { @@ -22,8 +20,10 @@ class ConfDynamicSuite extends munit.FunSuite { } test("did you mean?") { conf.dynamic.banna.asConf match { - case NotOk(err) => assert(err.toString.contains("Did you mean 'banana'")) - case Ok(value) => fail("Expected \"Did you mean 'banana'\" error") + case Configured.NotOk(err) => + assert(err.toString.contains("Did you mean 'banana'")) + case Configured.Ok(value) => + fail("Expected \"Did you mean 'banana'\" error") } } }