ReSharper 4.1 Inspection Severity




Code Redundancies

Anonymous method signature is not necessary
Assignment is not used
Double negation operator
Empty constructor
Empty destructor
Empty namespace declaration
Explicit delegate creation expression is redundant
Method return value is never used
‘params’ modifier is always ignored on overrides
Parentheses are redundant if attribute has no arguments
Redundant anonymous type property explicit name
Redundant base constructor call
Redundant ‘base.’ qualifier
Redundant boolean comparison
Redundant braces in collection initializer
Redundant ‘case’ label
Redundant cast
Redundant catch clause
Redundant class or interface specification in base types list
Redundant ‘else’ keyword
Redundant empty argument list on object creation expression
Redundant empty finally block
Redundant empty object or collection initializer
Redundant explicit nullable type creation
Redundant explicit size specification in array creation
Redundant explicit type in array creation
Redundant field initializer
Redundant lambda parameter explicit type specification
Redundant lambda signature parentheses
Redundant member override
Redundant name qualifier
Redundant ‘object.ToString()’ call
Redundant ‘partial’ modifier on method declaration
Redundant ‘partial’ modifier on type declaration
Redundant ‘string.ToCharArray()’ call
Redundant ‘this.’ qualifier
Redundant type arguments of method
Redundant using directive
Redundant XAML namespace alias
Redundant XAML resource
Sealed member in sealed class
‘true’ is redundant as ‘for’-statement condition
Underlying type of enum is ‘int’
Unsafe context declaration is redundant
Unused member in private type
Unused private member
Unused type parameter

Code Structure Analysis

Namespace does not correspond to file location

NAnt & MSBuild

Unknown item group
Unknown property
Unknown target
Unknown task
Unknown task element

Potential Errors & Bad Practices

Access to a static member of a type via a derived type
Access to modified closure
Auto-implemented property accessor is never used
Bitwise operation on enum which is not marked by [Flags] attribute
Compare with ‘==’ types marked by ‘CannotApplyEqualityOperatorAttribute’
Empty general catch clause
Exception rethrow possibly intended
Function never returns
Local variable hides member
‘Object.ReferenceEquals’ is always false because it is called with value type
Parameter hides member
Possible ambiguity while accessing member by interface
Possible compare of value type with ‘null’
Possible cyclic constructor call
Possible loss of fraction
Problems in format string
‘value’ parameter is not used
Virtual member call in constructor

Value Analysis

‘??’ condition is known to be null or not null
Expression is always ‘true’ or always ‘false’
Possible ‘null’ assignment to entity marked with ‘Value cannot be null’ attribute
Possible ‘System.NullReferenceException’


Code Redundancies

‘?:’ expression can be re-written as ‘??’ expression
Convert anonymous method to method group
Convert local variable or field to constant
Convert ‘Nullable<T>’ to ‘T?’
Convert property to auto property
Convert static method invocation to extension method call
Convert to lambda expression
Convert to static class
Field can be made readonly
‘if’ statement can be re-written as ‘?:’ expression
‘if’ statement can be re-written as ‘??’ expression
Iteration variable can be declared with a more specific type
Join local variable declaration and assignment
Local variable has too wide declaration scope
Make constructor in abstract class protected
Member can be made static
Parameter can be declared with base type
‘ref’ parameter can be made value
Use object or collection initializer when possible
Use ‘String.IsNullOrEmpty’
Use ‘var’ keyword when initializer explicitly declares type


Code Redundancies

Convert ‘if’ statement to ‘switch’ statement
Convert property to auto-property with private setter
‘if-return’ statement can be re-written as ‘return’ statement
Invert ‘if’ statement to reduce nesting
Similar anonymous type detected nearby
Use ‘var’ keyword when possible