Supported Code Quality rules
The rules for Code Quality listed below are classified by language according to their kind.
C
Go
Java
Best Practice
Reliability
-
Avoid Comparisons Against Character.MAX_VALUE / Character.MIN_VALUE
-
Avoid Comparisons Against Double.MAX_VALUE / Double.MIN_VALUE
-
Avoid Comparisons Against Integer.MAX_VALUE / Integer.MIN_VALUE
-
Do Not Use instanceof to Dispatch Exceptions in Catch Blocks
-
Entity Class Must Have an Accessible No-Argument Constructor
-
Iteration Over Non-Concurrent Collection Without Synchronization
-
Use Integer Version Instead of Timestamp for Optimistic Locking
Swift
Vbnet
Api Design
-
Attribute string literal cannot be parsed as the version or GUID it declares
-
Call to a framework method whose behaviour is unreliable or unsafe
-
Concrete custom attribute class is not declared NotInheritable
-
Diagnostic output written with Console or Debug.Print instead of a logger
-
Event handler declared Public, exposing it as part of the type’s API
-
Event handler signature does not follow the (sender, e) convention
-
Exported type does not implement the contract it is exported as
-
Log message assembled by concatenation or interpolation instead of a template
-
Method marked Pure is declared as a Sub and so returns no value
-
One-way service operation is declared as a Function with a return type
-
PartCreationPolicy is declared on a type that is not exported
-
Public member exposes a concrete collection type instead of an interface
-
Route template contains a backslash instead of a forward slash
-
Type with a Default indexed property implements no collection interface
Control Flow
-
Abrupt process termination via the End statement or Environment.Exit
-
Collection size or array length compared against an impossible bound
-
Condition uses And/Or instead of the short-circuiting AndAlso/OrElse
-
Else clause follows an If branch that always leaves the block
-
Loop body always jumps out, so it runs at most one iteration
-
Redundant Return or Exit statement at the end of a procedure
Error Handling
Interop
Naming
-
Collection type name does not end in Collection or Dictionary
-
Identifier carries a platform type name or a Hungarian type prefix
-
Private field name does not follow the _camelCase convention
-
Type name is the same as the name of the namespace containing it
-
Type name uses a reserved suffix its declaration does not earn
Performance
-
Externally visible member takes a multidimensional array parameter
-
Field or variable explicitly initialized to the default value of its type
-
Finalizer with an empty body, or one that only calls MyBase.Finalize
-
Property getter returns a fresh copy of a collection or array
-
ReadOnly field initialized with a literal, where Const would do
-
Timer fires more often than every 100 milliseconds, keeping the machine awake
-
Type resolved by name from a string literal instead of with GetType
Serialization
-
Optional serialized field has no deserialization callback to initialize it
-
Serialization event handler does not have the required signature
-
Type implements ISerializable and GetObjectData but has no serialization constructor
-
Type implements ISerializable but is not marked with the Serializable attribute
-
Type names ISerializable on its Implements clause but declares no GetObjectData