6.2.12.2. C#¶
Checks for C# coding style
Nested Rules
An enum used as bitfield requires a plural “s” |
|
Bodies of control statements like if, for and while require curly braces |
|
Checks for correctly used comment style in C# files |
|
Naming conventions for C# |
|
A goto statement should not have a target which is defined before the actual goto statement |
|
Do not use a single clause for catching all exceptions |
|
Parameters with modifiers ref and out should not be used |
|
Checks for CWEs in C# |
|
Check whether names and signatures of P/Invoke declarations match their native counterparts |
|
The logical operators && and || should not appear together in a full expression |
|
Reports a (suppressed) issue per entity of a configurable type |
|
Every enumerator has to be initialized |
|
A field should be either private or protected |
|
Use only certain characters for file names |
|
Imports warnings and errors produced by the C# compiler and analyzers |
|
Follow the guidelines for creating dependency properties |
|
Scans for comments containing a specified regular expression |
|
Functions must not exceed cyclomatic complexity limit |
|
An expression must not have more than N logical operators |
|
A function must have a nesting level less than or equal N |
|
Do not put more than one statement in a line |
|
A function must not have more than N parameters |
|
The length of a line of code must not exceed the character limit |
|
Instance methods that do not access instance members or other instance methods should be declared static |
|
Avoid blank lines after { and before } |
|
Do not hide a base method by a method in a derived type |
|
Do not use magic literals |
|
Do not use tabs |
|
Do not use trailing whitespace |
|
Name a source_file for a type defined in it |
|
No virtual calls in constructors or destructors |
Options
Setting an option for this rule means setting the default for all nested rules.
This rule shares the following common options: excludes, includes, justification_checker, post_processing, provider, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.