Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silencer plugin suppresses compilation errors when scalafix semantic db is enabled #43

Open
steinybot opened this issue Jan 28, 2020 · 8 comments

Comments

@steinybot
Copy link

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")
@steinybot
Copy link
Author

Here is a repo that reproduces the problem https://github.com/steinybot/bug-reports/tree/silencer/scalafix-incompatible

@ghik
Copy link
Owner

ghik commented Jan 28, 2020

Thanks for the report and reproduction. Without looking into details right now, this may be caused by the same problem as #7 which is ultimately a problem in the semanticdb compiler plugin: scalameta/scalameta#1505

Please try this workaround: #7 (comment)

@benwaffle
Copy link

@ghik that does not fix the bug for me

@davesmith00000
Copy link

We were having this problem over here, I didn't spot this open issue until just now:
scalameta/metals#1409

@ghik
Copy link
Owner

ghik commented Feb 17, 2020

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 (scala/scala#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

@ghik
Copy link
Owner

ghik commented Feb 18, 2020

This is most likely going to be fixed by scalameta/scalameta#1992

@timcharper
Copy link

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.

@bmarker
Copy link

bmarker commented Mar 15, 2023

I seem to be having this issue with Scala 2.12.17. Since the fix in scalameta/scalameta#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants