Proposed compiler options from one of my past projects:
val commonScalacOptions = Seq("-deprecation", "-feature", "-unchecked", "-Xfatal-warnings", "-Ybackend-parallelism", "8")
val warnScalacOptions = {
"dead-code extra-implicit inaccessible infer-any"
.split(" ").map("-Ywarn-" + _)
}
val lintScalacOptions = {
"doc-detached missing-interpolator nullary-override nullary-unit private-shadow stars-align type-parameter-shadow unsound-match"
.split(" ").map("-Xlint:" + _)
}
// partial-unification and scalatest don't like each other, should use them only in prod.
// At least until this is merged/new release is out: https://github.com/scalatest/scalatest/issues/1165
val productionOnlyScalacOptions = Seq("-Ywarn-value-discard", "-Ypartial-unification")
lazy val commonSettings = Seq(
scalaVersion := "2.12.10",
scalacOptions ++= commonScalacOptions ++ warnScalacOptions ++ lintScalacOptions,
scalacOptions in Compile ++= productionOnlyScalacOptions,
......
-Ywarn-value-discard is probably the most important one, it makes spotting e.g. dangling Futures/IOs easier.
Proposed compiler options from one of my past projects:
-Ywarn-value-discard
is probably the most important one, it makes spotting e.g. dangling Futures/IOs easier.