-
Notifications
You must be signed in to change notification settings - Fork 470
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
configure rule severity in .EditorConfig is not working for category level #5077
Comments
[*.cs] dotnet_analyzer_diagnostic.category-design.severity = error is not working |
@Ankhimes Have you tried "Design" instead of "design"? |
yes i have tried..didnt worked |
@Ankhimes Your issue here is that CA1031 is disabled by default, and |
Thanks for updates. But I did tried that option by updating the csproj file and its not working. Is there any other setting I need to try with. |
Can you share your project as a zip or at least the screenshot of entire project file? |
Ah, I get the core issue now. I know how we can fix this, I'll have a PR out for this sometime today/tomorrow. Meanwhile, I suggest you explicitly escalate each rule by rule ID instead of doing it by category. |
@mavasani Isn't this the same issue as dotnet/roslyn#51225 which got fixed? |
@Youssef1313 This is a different issue - the compiler is working as expected, the global config from AnalysisMode has ruleID based entry which will always override all category based entries. The solution is to change the config file generation for AnalysisMode to use category based entries. |
Got it thanks. Switching to the globalconfig generation to category based entries can affect other analyzers if they use the same category though, will that be intended? Wondering if rule-based configuration should override category-based only if it has a higher global_level? roslyn-analyzers/src/Tools/GenerateDocumentationAndConfigFiles/Program.cs Lines 1165 to 1172 in a0522af
|
So, I put more thought into this and I believe this scenario cannot be supported based on the current compiler and AnalsisMode design.
The only possible solution here could be if we introduce parallel group of auto-generated editorconfigs for enabling rules as warnings vs enabling them as errors. This is a much bigger work item, and we probably need more customer feedback before attempting any such changes. @Ankhimes - do you think just using |
@mavasani Thanks for your support. Unfortunately we don't have requirement to convert all warnings as error. |
@Ankhimes In that case you will need to do the following:
|
Closing this out as there is not much we can do here. You need to follow the suggestion above. |
Analyzer
Diagnostic ID: CA2013:
Do not use ReferenceEquals with value types
Analyzer source
SDK: Built-in CA analyzers in .NET 5 SDK or later
Version: SDK 5.0.100
OR
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 5.0.3 (Latest)
Describe the bug
Steps To Reproduce
Expected behavior
Actual behavior
Additional context
The text was updated successfully, but these errors were encountered: