silencer
silencer copied to clipboard
Silencer plugin suppresses compilation errors when scalafix semantic db is enabled
I had recently enabled the silencer sbt plugin and then started noticing really strange behaviour where I knew I had compilation errors but the sbt compile task would succeed. sbt test would also succeed but not actually run any tests.
It turns out that there is some sort of incompatibility between Silencer, Scalafix SemanticDB and Scala 2.13.1.
build.sbt:
scalaVersion := "2.13.1"
addCompilerPlugin(("com.github.ghik" % "silencer-plugin" % "1.4.4").cross(CrossVersion.full))
addCompilerPlugin(scalafixSemanticdb)
src/main/scala/Main.scala:
object Main extends App {
asldfkhaklsdgjkldfjv
}
project/build.properties:
sbt.version=1.3.7
project/plugins.sbt:
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.11")
Here is a repo that reproduces the problem https://github.com/steinybot/bug-reports/tree/silencer/scalafix-incompatible
Thanks for the report and reproduction. Without looking into details right now, this may be caused by the same problem as https://github.com/ghik/silencer/issues/7 which is ultimately a problem in the semanticdb compiler plugin: https://github.com/scalameta/scalameta/issues/1505
Please try this workaround: https://github.com/ghik/silencer/issues/7#issuecomment-383284150
@ghik that does not fix the bug for me
We were having this problem over here, I didn't spot this open issue until just now: https://github.com/scalameta/metals/issues/1409
This is most likely still the fault of scalameta plugin. The workraround probably does not work for Scala 2.13.1 because reporters have been refactored in scalac by @lrytz (https://github.com/scala/scala/pull/8338). semanticdb plugin needs to be updated to this new implementation.
Here's the 2.13.1+ version of silencer's SuppressingReporter: https://github.com/ghik/silencer/blob/master/silencer-plugin/src/main/scala-2.13%2B/com/github/ghik/silencer/SuppressingReporter.scala
The semanticdb plugin needs to do something similar with its SemanticdbReporter: https://github.com/scalameta/scalameta/blob/master/semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/SemanticdbReporter.scala
This is most likely going to be fixed by https://github.com/scalameta/scalameta/pull/1992
I have this issue when using scala 2.13.1, scalafix 0.9.11 and silencer 1.6.0.
Updating to scalafix 0.9.12 fixes the problem for me.
I seem to be having this issue with Scala 2.12.17. Since the fix in https://github.com/scalameta/scalameta/pull/1992 is for Scala 2.13.1+, I wonder if I maybe need an older version that does not have this issue.
I have silencer 1.7.12. I've tried both WartRemover 2.4.21 and 3.0.11. Even without Scalafix, just setting semanticdbEnabled causes problems. But normally I'm using Scalafix 0.10.4.
Update: It looks like there is a different reporter implementation for Scala 2.12.10 vs. 2.12.13 so maybe they did fix it and I just don't have a new enough version of SemanticDB.