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

The editor config should allow specifying whether a warning is included in code cleanup #73321

Open
SoggyBottomBoy opened this issue May 3, 2024 · 0 comments
Labels
Area-IDE Feature Request untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@SoggyBottomBoy
Copy link

Summary

The editor config should allow for some configuration options per rule that state whether the rule is included as part of code cleanup.

Background and Motivation

The VS option to Fix analyzer warnings and errors set in EditorConfig can be very aggressive and unhelpful for some warnings that are commonly generated when writing code. Namely CS0219 - The variable 'variable' is assigned but its value is never used is commonly created when writing code, and saving the file will automatically remove these. Changing the rule to suggestion will mean that it is not cleaned up on save, however, the suggestion is much harder to spot than errors/warnings.

We currently have this rule as warning in CI but suggestion for developers. It is frustrating when this suggestion is not immediately obvious in VS and only caught in CI which can take up to 10min and relies on the developer checking their CI workflow.

Proposed Feature

I'm suggesting that a cleanup option is added to the editor config so that a analyzer can both be a error/warning and not be cleaned up on save.

dotnet_diagnostic.CS0219.severity = warning
dotnet_diagnostic.CS0219.cleanup = false

Alternative Designs

I guess one alternative is make this suggestion more obvious in visual studio. I'm not sure if there is an option to do this, but the red and green squiggles for errors/warnings are very obvious. The suggestion is three dots that are hard to spot. I believe this is a blue squiggle in VSCode, and VS could allow for the same?

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label May 3, 2024
@SoggyBottomBoy SoggyBottomBoy changed the title The editor config should allow specifying whether a warning is include in code cleanup The editor config should allow specifying whether a warning is included in code cleanup May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant