-Xfatal-warnings

This commit is contained in:
Eugene Yokota 2018-09-19 22:46:38 -04:00
parent 9beff33152
commit cf0467609d
10 changed files with 18 additions and 22 deletions

View File

@ -14,15 +14,6 @@ def commonSettings: Seq[Setting[_]] = Seq(
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
crossScalaVersions := Seq(scala211, scala212), crossScalaVersions := Seq(scala211, scala212),
scalacOptions := {
val old = scalacOptions.value
scalaVersion.value match {
case sv if sv.startsWith("2.10") =>
old diff List("-Xfuture", "-Ywarn-unused", "-Ywarn-unused-import")
case sv if sv.startsWith("2.11") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import")
case _ => old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
}
},
scalacOptions in console in Compile -= "-Ywarn-unused-import", scalacOptions in console in Compile -= "-Ywarn-unused-import",
scalacOptions in console in Test -= "-Ywarn-unused-import", scalacOptions in console in Test -= "-Ywarn-unused-import",
publishArtifact in Compile := true, publishArtifact in Compile := true,
@ -110,8 +101,10 @@ lazy val utilLogging = (project in internalPath / "util-logging")
crossScalaVersions := Seq(scala210, scala211, scala212), crossScalaVersions := Seq(scala210, scala211, scala212),
name := "Util Logging", name := "Util Logging",
libraryDependencies ++= libraryDependencies ++=
Seq(jline, log4jApi, log4jCore, disruptor, sjsonnewScalaJson.value, scalaReflect.value), Seq(jline, log4jApi, log4jCore, disruptor, sjsonnewScalaJson.value, scalaReflect.value,
compilerPlugin(silencerPlugin), silencerLib),
libraryDependencies ++= Seq(scalaCheck, scalaTest), libraryDependencies ++= Seq(scalaCheck, scalaTest),
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
contrabandFormatsForType in generateContrabands in Compile := { tpe => contrabandFormatsForType in generateContrabands in Compile := { tpe =>
val old = (contrabandFormatsForType in generateContrabands in Compile).value val old = (contrabandFormatsForType in generateContrabands in Compile).value

View File

@ -4,13 +4,14 @@
package sbt.internal.util package sbt.internal.util
import sbt.util._ import sbt.util._
import com.github.ghik.silencer.silent
/** /**
* A filter logger is used to delegate messages but not the logging level to another logger. This means * A filter logger is used to delegate messages but not the logging level to another logger. This means
* that messages are logged at the higher of the two levels set by this logger and its delegate. * that messages are logged at the higher of the two levels set by this logger and its delegate.
*/ */
class FilterLogger(delegate: AbstractLogger) extends BasicLogger { class FilterLogger(delegate: AbstractLogger) extends BasicLogger {
override lazy val ansiCodesSupported = delegate.ansiCodesSupported @silent override lazy val ansiCodesSupported = delegate.ansiCodesSupported
def trace(t: => Throwable): Unit = { def trace(t: => Throwable): Unit = {
if (traceEnabled) if (traceEnabled)
delegate.trace(t) delegate.trace(t)

View File

@ -4,11 +4,12 @@
package sbt.internal.util package sbt.internal.util
import sbt.util._ import sbt.util._
import com.github.ghik.silencer.silent
/** Promotes the simple Logger interface to the full AbstractLogger interface. */ /** Promotes the simple Logger interface to the full AbstractLogger interface. */
class FullLogger(delegate: Logger) extends BasicLogger { class FullLogger(delegate: Logger) extends BasicLogger {
@deprecated("No longer used.", "1.0.0") @deprecated("No longer used.", "1.0.0")
override val ansiCodesSupported: Boolean = delegate.ansiCodesSupported @silent override val ansiCodesSupported: Boolean = delegate.ansiCodesSupported
def trace(t: => Throwable): Unit = { def trace(t: => Throwable): Unit = {
if (traceEnabled) if (traceEnabled)

View File

@ -4,13 +4,14 @@
package sbt.internal.util package sbt.internal.util
import sbt.util._ import sbt.util._
import com.github.ghik.silencer.silent
// note that setting the logging level on this logger has no effect on its behavior, only // note that setting the logging level on this logger has no effect on its behavior, only
// on the behavior of the delegates. // on the behavior of the delegates.
class MultiLogger(delegates: List[AbstractLogger]) extends BasicLogger { class MultiLogger(delegates: List[AbstractLogger]) extends BasicLogger {
@deprecated("No longer used.", "1.0.0") @deprecated("No longer used.", "1.0.0")
override lazy val ansiCodesSupported = delegates exists supported override lazy val ansiCodesSupported = delegates exists supported
private[this] def supported = (_: AbstractLogger).ansiCodesSupported @silent private[this] def supported = (_: AbstractLogger).ansiCodesSupported
override def setLevel(newLevel: Level.Value): Unit = { override def setLevel(newLevel: Level.Value): Unit = {
super.setLevel(newLevel) super.setLevel(newLevel)

View File

@ -24,7 +24,6 @@ final case class RangePosition(path: String, range: LineRange) extends FilePosit
object SourcePosition { object SourcePosition {
/** Creates a SourcePosition by using the enclosing position of the invocation of this method. /** Creates a SourcePosition by using the enclosing position of the invocation of this method.
* @see [[scala.reflect.macros.Enclosures#enclosingPosition]]
* @return SourcePosition * @return SourcePosition
*/ */
def fromEnclosing(): SourcePosition = macro SourcePositionMacro.fromEnclosingImpl def fromEnclosing(): SourcePosition = macro SourcePositionMacro.fromEnclosingImpl

View File

@ -7,7 +7,7 @@ object Dependencies {
val scala211 = "2.11.12" val scala211 = "2.11.12"
val scala212 = "2.12.6" val scala212 = "2.12.6"
private val ioVersion = "1.2.0" private val ioVersion = "1.2.1"
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
@ -58,4 +58,6 @@ object Dependencies {
val log4jApi = "org.apache.logging.log4j" % "log4j-api" % log4jVersion val log4jApi = "org.apache.logging.log4j" % "log4j-api" % log4jVersion
val log4jCore = "org.apache.logging.log4j" % "log4j-core" % log4jVersion val log4jCore = "org.apache.logging.log4j" % "log4j-core" % log4jVersion
val disruptor = "com.lmax" % "disruptor" % "3.3.6" val disruptor = "com.lmax" % "disruptor" % "3.3.6"
val silencerPlugin = "com.github.ghik" %% "silencer-plugin" % "1.2"
val silencerLib = "com.github.ghik" %% "silencer-lib" % "1.2" % Provided
} }

View File

@ -1,3 +1,3 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.7") addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.8")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.0") addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9")

View File

@ -4,7 +4,6 @@
package sbt.util package sbt.util
import java.io.File import java.io.File
import java.io.FileNotFoundException
import scala.util.control.NonFatal import scala.util.control.NonFatal
import sbt.io.{ Hash, IO } import sbt.io.{ Hash, IO }
import sjsonnew.{ Builder, JsonFormat, Unbuilder, deserializationError } import sjsonnew.{ Builder, JsonFormat, Unbuilder, deserializationError }

View File

@ -46,7 +46,7 @@ class CacheSpec extends FlatSpec {
} }
cache(store)("someKey") match { cache(store)("someKey") match {
case Hit(read) => assert(read === value) case Hit(read) => assert(read === value); ()
case Miss(_) => fail case Miss(_) => fail
} }
} }
@ -63,7 +63,7 @@ class CacheSpec extends FlatSpec {
} }
cache(store)(key) match { cache(store)(key) match {
case Hit(read) => assert(read === value) case Hit(read) => assert(read === value); ()
case Miss(_) => fail case Miss(_) => fail
} }
} }

View File

@ -69,7 +69,7 @@ class SingletonCacheSpec extends FlatSpec {
cache.write(store, value) cache.write(store, value)
val read = cache.read(store) val read = cache.read(store)
assert(read === value) assert(read === value); ()
} }
} }
@ -80,7 +80,7 @@ class SingletonCacheSpec extends FlatSpec {
cache.write(store, value) cache.write(store, value)
val read = cache.read(store) val read = cache.read(store)
assert(read === value) assert(read === value); ()
} }
} }