-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Unable to override severity of single rules when dotnet_analyzer_diagnostic.severity != unset|default #61777
Comments
@leoniDEV I am unable to reproduce this on the latest 17.3 preview build. Can you please re-confirm if you are still seeing this? If so, can you please share a repro project? |
After further investigation it seems a problem with the UI. If you expand the Anyway here a repro project https://github.com/leoniDEV/Repro-proj-61777 |
Adding @chsienki and @jasonmalinowski. Thanks @leoniDEV. I investigated this further and it seems the issue here is that diagnostic severity entries in global config files (basically
Personally, I feel AnalyzerConfigOptionsResult.TreeOptions returned from Moving this issue to compilers area path and assigning to @chsienki to comment. |
@mavasani Do you think this issue I'm having is related? #72726 # C# files
[*.cs]
# CA1041: Provide ObsoleteAttribute message
dotnet_diagnostic.CA1041.severity = warning
# Field preferences
dotnet_style_readonly_field = true:warning
# Unit Test Overrides
# Rules don't have to be as strict.
[**UnitTests**/*.cs]
# CA1041: Provide ObsoleteAttribute message
dotnet_diagnostic.CA1041.severity = suggestion
# Field preferences
dotnet_style_readonly_field = true:suggestion The second |
Version Used:
VisualStudio.17.Preview/17.3.0-pre.1.1+32519.111
.net 7.0.100-preview.4.22252.9
Steps to Reproduce:
.globalconfig
dotnet_analyzer_diagnostic.severity = error
dotnet_diagnostic.<StyleCop rule ID>.severity = warning
Expected Behavior:
The severity of
<StyleCop rule ID>
is warningActual Behavior:
The severity of the still error
Additional Notes
Whatever is the severity in
dotnet_analyzer_diagnostic.severity
I'm unable to override the severity of a single rule but I'm still able to override the severity of an entire category with the keydotnet_analyzer_diagnostic.category-<rule category>.severity
This behavior occurs with analyzers installed from Nuget, at least with StyleCop, sonar-dotnet and Roslynator (which are the ones I tested).
With the built-in NetAnalyzer all works as expected (I'm still able to override the severity of a single rule), but if I disable the built-in analyzer using the property
<EnableNETAnalyzers>false</EnableNETAnalyzers>
and install the analyzer from Nuget also the NetAnalyzer follow the same behavior of the other third-party analyzerThe text was updated successfully, but these errors were encountered: