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

RemoveUnused: document 2.13.2 -Wconf to keep -Xfatal-warnings #1115

Merged
merged 2 commits into from May 13, 2020

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented May 7, 2020

I have successfully used scala/scala#8373 on my build to keep/relax -Xfatal-warnings, and delegate unused imports fix/enforcement from scalac to scalafix.

The only impact of -Wconf:cat=unused:info on semanticdb-scalac 4.3.10 seems to be the severity attribute, so the rule works as-is.

  diagnostics {
    range {
      start_line: 2
      start_character: 17
      end_line: 2
      end_character: 23
    }
    severity: INFORMATION
    message: "Unused import"
  }

Unfortunately, it's impossible to demonstrate that, as the testkit
currently requires the test input project and the overall Scalafix
build to have the same scala version.
Unfortunately, it's not possible exclude unused imports from -Xfatal-warnings.
compiler warnings do not fail the build before running Scalafix. If you are
running 2.13.2 or later, you may keep `-Xfatal-warnings` by modifying how
specific warnings are handled via `scalacOptions += "-Wconf:cat=unused:info"`.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried

Suggested change
specific warnings are handled via `scalacOptions += "-Wconf:cat=unused:info"`.
specific warnings are handled via `scalacOptions += "-Wconf:cat=unused:silent"`.

but it does what you can expect: the diagnostic is gone!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I suppose that makes sense! The info messages are anyways a good reminder that you have unused imports that can be removed

@bjaglin bjaglin marked this pull request as ready for review May 7, 2020 22:04
Copy link
Contributor

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you!

@olafurpg olafurpg merged commit 02e305e into scalacenter:master May 13, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants