With a build.sbt file like:
ThisBuild / organization := "com.company"
ThisBuild / version := "1.0.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.11.12"
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1)
Global / scalacOptions ++= Seq("-Ypartial-unification",
"-unchecked",
"-Xfatal-warnings",
"-Ywarn-dead-code",
"-Ywarn-inaccessible",
"-Ywarn-unused",
"-Ywarn-unused-import",
"-Ywarn-macros:after")
I get [error] bad option: '-Ywarn-macros:none'
after running sbt clean compile
Without -Ywarn-macros:after
, the unused import warning raises spurious warnings in files using Circe macros, for example: import io.circe.{ Decoder, Encoder }
.
-Ywarn-macros
wasn't added until Scala 2.12, so the error is expected.
Can you upgrade to Scala 2.12? If you are stuck on 2.11, perhaps you will need to live without -Ywarn-unused-import
. (Unused warnings in general have greatly improved as the 2.12.x series has progressed, thanks to tireless work on it by Som Snytt.)
You might be able to confine the Circe-using code to a subproject, and then disable unused warnings in that subproject only, in order to leave them enabled in the rest of your codebase.
Another possibility is to try https://github.com/ghik/silencer.