如果代码库中有任何未使用的导入、本地或私有变量或死代码,我会尝试编译失败。所以,我添加了以下 scalacoptions。
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-Xfatal-warnings",
"-Xlint:-unused,_",
"-Ywarn-dead-code",
"-Ywarn-unused:imports", // Warn if an import selector is not referenced
"-Ywarn-unused:locals", // Warn if a local definition is unused
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused
"-Ywarn-unused:privates", // Warn if a private member is unused
"-deprecation"
)
但是每当我编译我的项目时,它都会编译失败并给出以下错误。
[error] 'imports' is not a valid choice for '-Ywarn-unused'
[error] bad option: '-Ywarn-unused:imports'
斯卡拉版本:2.11.11
我不确定我在做什么错误。