The code quality rules have additional configuration options, besides just configuring their severity. For example, each code quality analyzer can be configured to only apply to specific parts of your codebase. You specify these options by adding key-value pairs to the same EditorConfig file where you specify rule severities and general editor preferences.
Napomena
This article does not detail how to configure a rule's severity. The .editorconfig option to set a rule's severity has a different prefix (dotnet_diagnostic) to the options described here (dotnet_code_quality). In addition, the options described here pertain to code quality rules only, whereas the severity option applies to code style rules as well. As a quick reference, you can configure a rule's severity using the following option syntax:
public (applies to public and protected APIs) internal or friend (applies to internal and private protected APIs) private (applies to private APIs) all (applies to all APIs)
Names of null-check validation methods that validate that arguments passed to the method are non-null
Allowed method name formats (separated by |): - Method name only (includes all methods with the name, regardless of the containing type or namespace) - Fully qualified names in the symbol's documentation ID format, with an optional M: prefix
Allowed method name formats (separated by |): - Method name only (includes all methods with the name, regardless of the containing type or namespace) - Fully qualified names in the symbol's documentation ID format, with an optional M: prefix
Names of types, such that the type and all its derived types are excluded for analysis
Allowed symbol name formats (separated by |): - Type name only (includes all types with the name, regardless of the containing type or namespace) - Fully qualified names in the symbol's documentation ID format, with an optional T: prefix
Allowed symbol name formats (separated by |): - Symbol name only (includes all symbols with the name, regardless of the containing type or namespace) - Fully qualified names in the symbol's documentation ID format. Each symbol name requires a symbol kind prefix, such as M: prefix for methods, T: prefix for types, and N: prefix for namespaces. - .ctor for constructors and .cctor for static constructors
Names of symbols that are disallowed in the context of the analysis
Allowed symbol name formats (separated by |): - Symbol name only (includes all symbols with the name, regardless of the containing type or namespace) - Fully qualified names in the symbol's documentation ID format. Each symbol name requires a symbol kind prefix, such as M: prefix for methods, T: prefix for types, and N: prefix for namespaces. - .ctor for constructors and .cctor for static constructors
Boolean option to enable heuristic detection of additional string formatting methods. A method is considered a string formatting method if it has a string format parameter followed by a params object[] parameter.
Specifies the threshold to trigger the enum values naming rule
- AnyEnumValue - The rule is triggered if any of the enum values starts with the enum type name. - AllEnumValues - The rule is triggered if all of the enum values start with the enum type name. - Heuristic - The rule is triggered using the default FxCop heuristic (that is, when at least 75% of the enum values start with the enum type name).
List of type names (separated by |) with their required suffix (separated by ->). Allowed type name formats: - Type name only (includes all types with the name, regardless of the containing type or namespace). - Fully qualified names in the symbol's documentation ID format with an optional T: prefix.
List of interface names (separated by |) with their required generic fully qualified interface (separated by ->). Allowed interface formats: - Interface name only (includes all interfaces with the name, regardless of the containing type or namespace). - Fully qualified names in the symbol's documentation ID format with an optional T: prefix.
All types implementing System.Collections.IDictionary are expected to also implement System.Collections.Generic.IDictionary`2.
additional_inheritance_excluded_symbol_names
Description
Allowable values
Default value
Configurable rules
Specifies types or namespaces to exclude from the inheritance hierarchy tree
Allowed type name formats: - Type or namespace name (includes all types with the name, regardless of the containing type or namespace, and all types whose namespace contains the name). - Type or namespace name ending with a wildcard symbol (includes all types whose name starts with the given name, regardless of the containing type or namespace, and all types whose namespace contains the name). - Fully qualified names in the symbol's documentation ID format with an optional T: prefix for types or N: prefix for namespaces. - Fully qualified type or namespace name with an optional T: prefix for type or N: prefix for namespace and ending with the wildcard symbol (includes all types whose fully qualified name starts with the given type name, or all types whose fully qualified name starts with the given namespace name).
N:System.* (This value is always automatically added to the value provided)
Specifies additional custom APIs whose results must be used
Names of additional methods (separated by |). Allowed method name formats: - Method name only (includes all methods with the name, regardless of the containing type or namespace). - Fully qualified names in the symbol's documentation ID format with an optional M: prefix.
Specifies which paths to analyze for dispose violations
- AllPaths - Track and report missing dispose violations on all paths (non-exception and exception paths). Additionally, also flag use of non-recommended dispose patterns that might cause potential dispose leaks. - AllPathsOnlyNotDisposed - Track and report missing dispose violations on all paths (non-exception and exception paths). Do not flag use of non-recommended dispose patterns that might cause potential dispose leaks. - NonExceptionPaths - Track and report missing dispose violations only on non-exception program paths. Additionally, also flag use of non-recommended dispose patterns that might cause potential dispose leaks. - NonExceptionPathsOnlyNotDisposed - Track and report missing dispose violations only on non-exception program paths. Do not flag use of non-recommended dispose patterns that might cause potential dispose leaks.
Izvor za ovaj sadržaj možete pronaći na GitHubu, gdje možete stvarati i pregledavati probleme i zahtjeve za povlačenjem. Dodatne informacije potražite u našem vodiču za suradnike.
Povratne informacije o proizvodu .NET
.NET je projekt otvorenog koda. Odaberite vezu za slanje povratnih informacija:
Pridružite se seriji susreta kako biste s kolegama programerima i stručnjacima izgradili skalabilna rješenja umjetne inteligencije temeljena na stvarnim slučajevima upotrebe.