Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SBT: treat warnings as errors #273

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
12 changes: 12 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -208,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("\\+.*", ""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "; ",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package metaconfig
import metaconfig.Configured.NotOk
import metaconfig.Configured.Ok
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, feel free to skip all of this comment:

  • i'd add a blank line after package
  • i'd import as a wildcard metaconfig.Configured._

or i'd simply use case Configured.Xxx(...) below, like they did before, without adding imports.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


class ConfDynamicSuite extends munit.FunSuite {

Expand All @@ -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")
}
}
}
Loading