Enable fatal errors for docs (#29570)

This commit is contained in:
Arnout Engelen 2020-09-08 15:10:21 +02:00 committed by GitHub
parent e0ceb71ccd
commit ca59d8149c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 268 additions and 223 deletions

View file

@ -18,7 +18,6 @@ object AkkaDisciplinePlugin extends AutoPlugin {
val enabled = !sys.props.contains("akka.no.discipline")
// We allow warnings in docs to get the 'snippets' right
val nonFatalWarningsFor = Set("akka-docs")
val nonFatalJavaWarningsFor = Set(
// for sun.misc.Unsafe and AbstractScheduler
"akka-actor",
@ -51,6 +50,7 @@ object AkkaDisciplinePlugin extends AutoPlugin {
"akka-cluster-sharding",
"akka-cluster-sharding-typed",
"akka-distributed-data",
"akka-docs",
"akka-persistence",
"akka-persistence-tck",
"akka-persistence-typed",
@ -74,10 +74,7 @@ object AkkaDisciplinePlugin extends AutoPlugin {
lazy val disciplineSettings =
if (enabled) {
silencerSettings ++ Seq(
Compile / scalacOptions ++= (
if (!nonFatalWarningsFor(name.value)) Seq("-Xfatal-warnings")
else Seq.empty
),
Compile / scalacOptions ++= Seq("-Xfatal-warnings"),
Test / scalacOptions --= testUndicipline,
Compile / javacOptions ++= (
if (!nonFatalJavaWarningsFor(name.value)) Seq("-Werror", "-Xlint:deprecation", "-Xlint:unchecked")
@ -136,4 +133,23 @@ object AkkaDisciplinePlugin extends AutoPlugin {
"-Ypartial-unification",
"-Ywarn-extra-implicit")
/**
* We are a little less strict in docs
*/
val docs = Seq(
scalacOptions ++= Seq(
// In docs, 'unused' variables can be useful for naming and showing the type
"-P:silencer:globalFilters=is never used",
// Import statements are often duplicated across multiple snippets in one file
"-P:silencer:globalFilters=Unused import",
// We keep documentation for this old API around for a while:
"-P:silencer:globalFilters=in object Dns is deprecated",
"-P:silencer:globalFilters=in class Dns is deprecated",
// Because we sometimes wrap things in a class:
"-P:silencer:globalFilters=The outer reference in this type test cannot be checked at run time",
// Because we show some things that are deprecated in
// 2.13 but don't have a replacement that was in 2.12:
"-P:silencer:globalFilters=deprecated \\(since 2.13.0\\)"
)
)
}