roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Suggestion: IDE0079 (Remove unnecessary suppression) allow .editorconfig to support prefixes

Open NickCraver opened this issue 4 years ago • 5 comments

Analyzer

Diagnostic ID: IDE0079

Describe the improvement

Today in configuring this rule, .editorconfig allows all, none, or a comma-delimited list of analyzer IDs. In the comma list, it also supports category: for all things in a specific category. I propose we add support for prefix: to this configuration, e.g.

dotnet_remove_unnecessary_suppression_exclusions = prefix:RCS
# Multiple example:
dotnet_remove_unnecessary_suppression_exclusions = CA1009,CA1063,prefix:RCS

This would ignore all RCS* rules, e.g. RCS0001, RCS0002, etc.

Additional context

The intent of IDE0079 is great, but the reality is that different team members may have more invasive/noisy analyzers running (for example, I run additional heap and allocation analyzers), so the experience between team members is inconsistent and can easily make edit/reverse commits (achieving only noise) making these go back and forth. It's apparent to me that the .editorconfig support was meant to address this case, but this would improve it. When we're including analyzers or not between team members, it's likely via an extension one person has but not another. Those extensions don't often have one big category for all analyzers...but they do have a common prefix.

If we allowed IDE0079 to be turned off in that way, it'd save a lot of time in both ignoring each one and the edit/reverse steps to get there. Importantly: the problem with this analyzer doesn't happen on the person's machine using additional analyzers, it happens on everyone else's machine. That makes the user experience a few steps away to get to the desired team-wide result. If we had a prefix route like this, it'd be a better way to address it than repeating such discussions whenever a new analyzer is added, suppressed, removed by someone seeing it in IDE0079, original adder seeing it, syncing with team mate, adding to .editorconfig, etc. Repeating that process results in a negative experience overall, so I think it'd be great to better address it and maintain the utility IDE0079 provides.

NickCraver avatar Jun 27 '21 16:06 NickCraver

I would suggest to not add the prefix: part but instead to use the wildcard symbol (i.e. RCS*), this would be similar to the other abilities we have added.

Side note, I think that IDE0079 is directly on roslyn not on this repo. Tagging @mavasani

Evangelink avatar Jun 27 '21 19:06 Evangelink

Conclusion from design meeting: Just use a wildcard, no prefix:

akhera99 avatar Oct 19 '21 17:10 akhera99

@NickCraver, did RCS* actually work for you? I try to suppress all SonarQube suppressions from IDE0079 using dotnet_remove_unnecessary_suppression_exclusions = S* But I still get loads of IDE0079 about SonarQube suppressions. Listing individual Ids works, but is cumbersome dotnet_remove_unnecessary_suppression_exclusions = S107,S1200,S1210,S1144,S1541

kooszoon avatar Dec 02 '25 14:12 kooszoon

@kooszoon nothing has changed here. That's why the request is still open.

CyrusNajmabadi avatar Dec 02 '25 15:12 CyrusNajmabadi

Ah, thanks. I thought the wildcard was already available.

kooszoon avatar Dec 03 '25 07:12 kooszoon