Rule categories

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.

Category Description EditorConfig value
Design rules Design rules support adherence to the .NET Framework Design Guidelines. dotnet_analyzer_diagnostic.category-Design.severity
Documentation rules Documentation rules support writing well-documented libraries through the correct use of XML documentation comments for externally visible APIs. dotnet_analyzer_diagnostic.category-Documentation.severity
Globalization rules Globalization rules support world-ready libraries and applications. dotnet_analyzer_diagnostic.category-Globalization.severity
Portability and interoperability rules Portability rules support portability across different platforms. Interoperability rules support interaction with COM clients. dotnet_analyzer_diagnostic.category-Interoperability.severity
Maintainability rules Maintainability rules support library and application maintenance. dotnet_analyzer_diagnostic.category-Maintainability.severity
Naming rules Naming rules support adherence to the naming conventions of the .NET design guidelines. dotnet_analyzer_diagnostic.category-Naming.severity
Performance rules Performance rules support high-performance libraries and applications. dotnet_analyzer_diagnostic.category-Performance.severity
SingleFile rules Single-file rules support single-file applications. dotnet_analyzer_diagnostic.category-SingleFile.severity
Reliability rules Reliability rules support library and application reliability, such as correct memory and thread usage. dotnet_analyzer_diagnostic.category-Reliability.severity
Security rules Security rules support safer libraries and applications. These rules help prevent security flaws in your program. dotnet_analyzer_diagnostic.category-Security.severity
Style rules Style rules support consistent code style in your codebase. These rules start with the "IDE" prefix. dotnet_analyzer_diagnostic.category-Style.severity
Usage rules Usage rules support proper usage of .NET. dotnet_analyzer_diagnostic.category-Usage.severity
N/A You can use this EditorConfig value to enable the following rules: IDE0051, IDE0064, IDE0076. While these rules start with "IDE", they are not technically part of the Style category. dotnet_analyzer_diagnostic.category-CodeQuality.severity