Each code analysis rule belongs to a category of rules. For example, design rules support adherence to the .NET design guidelines, and security rules help prevent security flaws. You can configure the severity level for an entire category of rules. You can also configure additional options on a per-category basis.
The following table shows the different code analysis rule categories and provides a link to the rules in each category. It also lists the configuration value to use in an EditorConfig file to bulk-configure rule severity on a per-category basis. For example, to set the severity of security rule violations to be errors, the EditorConfig entry is dotnet_analyzer_diagnostic.category-Security.severity = error.
Tip
Setting the severity for a category of rules using the dotnet_analyzer_diagnostic.category-<category>.severity syntax doesn't apply to rules that are disabled by default. However, starting in .NET 6, you can use the AnalysisMode<Category> project property to enable all the rules in a category.
* Use the EditorConfig value dotnet_analyzer_diagnostic.category-CodeQuality.severity to enable the following rules: IDE0051, IDE0052, IDE0064, and IDE0076. While these rules start with "IDE", they aren't technically part of the Style category.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.