Code Inspections in VB.NET
In VB.NET, JetBrains Rider 2017.2 provides two kinds of code inspections: 244 inspections that detect errors such as broken syntax, unresolved symbols, compiler errors, etc. (you cannot configure or disable any of these inspections), and 243 proprietary code inspections, any of which you can disable or change its severity level.
These code inspections help you detect code issues in design time in all open files, and additionally they allow you to find code issues in specific scope.
Configurable VB.NET inspections are listed below, grouped in the following categories:
- Code Notification (1 inspection)
- Common Practices and Code Improvements (107 inspections)
- Compiler Warnings (22 inspections)
- Constraints Violations (2 inspections)
- Language Usage Opportunities (4 inspections)
- Potential Code Quality Issues (60 inspections)
- Redundancies in Code (22 inspections)
- Redundancies in Symbol Declarations (25 inspections)
Code Notification (1 inspection)
This category groups code inspections with minor severity levels.Inspection | Default Severity |
---|---|
Inactive preprocessor branch | Warning |
Common Practices and Code Improvements (107 inspections)
This category groups inspections that hunt for medium severity issues that mainly affect code readability.Inspection | Default Severity |
---|---|
Annotation duplicate in hierarchy | Warning |
Auto-property can be made get-only (non-private accessibility) | Suggestion |
Auto-property can be made get-only (private accessibility) | Suggestion |
Check for reference equality instead | Suggestion |
Check for reference equality instead | Suggestion |
Class can be made sealed(non-inheritable) (non-private accessibility) | Disabled |
Class can be made sealed(non-inheritable) (private accessibility) | Disabled |
Container nullability attribute usage with declaration of non-container type | Warning |
Convert local variable or field to constant (non-private accessibility) | Hint |
Convert local variable or field to constant (private accessibility) | Hint |
Convert property to auto-property | Suggestion |
Convert property to auto-property when possible | Hint |
Convert property to auto-property with private setter | Hint |
Field can be made readonly (non-private accessibility) | Suggestion |
Field can be made readonly (private accessibility) | Suggestion |
Get-only auto-property is never assigned | Warning |
Member can be made private (non-private accessibility) | Suggestion |
Member can be made private (private accessibility) | Suggestion |
Member can be made protected (non-private accessibility) | Suggestion |
Member can be made protected (private accessibility) | Suggestion |
Member can be made static(shared) (non-private accessibility) | Hint |
Member can be made static(shared) (private accessibility) | Hint |
Member or type can be made internal(friend) | Disabled |
Multiple nullable attributes usage | Warning |
Nullability attribute usage with declaration of void or value type | Warning |
Parameter can be declared with base type | Hint |
Parameter type can be IEnumerable<T> (non-private accessibility) | Hint |
Parameter type can be IEnumerable<T> (private accessibility) | Hint |
Possible mistaken argument | Warning |
Possible mistaken call to GetType() | Warning |
Possible mistaken call to GetType() | Warning |
Remove ToList() | Suggestion |
Remove ToList() | Suggestion |
Replace with FirstOrDefault($args$) | Suggestion |
Replace with LastOrDefault($args$) | Suggestion |
Replace with OfType<T>() (replace with OfType(Of ..)()) | Suggestion |
Replace with OfType<T>() (replace with OfType(Of ..)()) | Suggestion |
Replace with OfType<T>().Any() (replace with OfType(Of ..)().Any()) | Suggestion |
Replace with OfType<T>().Any() (replace with OfType(Of ..)().Any(..)) | Suggestion |
Replace with OfType<T>().Count() (replace with OfType(Of ..)().Count()) | Suggestion |
Replace with OfType<T>().Count() (replace with OfType(Of ..)().Count(..)) | Suggestion |
Replace with OfType<T>().First() (replace with OfType(Of ..)().First()) | Suggestion |
Replace with OfType<T>().First() (replace with OfType(Of ..)().First(..)) | Suggestion |
Replace with OfType<T>().FirstOrDefault() (replace with OfType(Of ..)().FirstOrDefault()) | Suggestion |
Replace with OfType<T>().FirstOrDefault() (replace with OfType(Of ..)().FirstOrDefault(..)) | Suggestion |
Replace with OfType<T>().Last() (replace with OfType(Of ..)().Last()) | Suggestion |
Replace with OfType<T>().Last() (replace with OfType(Of ..)().Last(..)) | Suggestion |
Replace with OfType<T>().LastOrDefault() (replace with OfType(Of ..)().LastOrDefault()) | Suggestion |
Replace with OfType<T>().LastOrDefault() (replace with OfType(Of ..)().LastOrDefault(..)) | Suggestion |
Replace with OfType<T>().Single() (replace with OfType(Of ..)().Single()) | Suggestion |
Replace with OfType<T>().Single() (replace with OfType(Of ..)().Single(..)) | Suggestion |
Replace with OfType<T>().SingleOrDefault() (replace with OfType(Of ..)().SingleOrDefault()) | Suggestion |
Replace with OfType<T>().SingleOrDefault() (replace with OfType(Of ..)().SingleOrDefault(..)) | Suggestion |
Replace with OfType<T>().Where() (replace with OfType(Of ..)().Where(..)) | Suggestion |
Replace with single assignment | Suggestion |
Replace with single assignment | Suggestion |
Replace with single call to Any(..) | Suggestion |
Replace with single call to Count(..) | Suggestion |
Replace with single call to First(..) | Suggestion |
Replace with single call to FirstOrDefault(..) | Suggestion |
Replace with single call to Last(..) | Suggestion |
Replace with single call to LastOrDefault(..) | Suggestion |
Replace with single call to Single(..) | Suggestion |
Replace with single call to SingleOrDefault(..) | Suggestion |
Replace with SingleOrDefault($args$) | Suggestion |
Return type can be IEnumerable<T> (non-private accessibility) | Hint |
Return type can be IEnumerable<T> (private accessibility) | Hint |
Simplify conditional operator | Suggestion |
Simplify expression | Suggestion |
Simplify expression | Suggestion |
Simplify expression | Suggestion |
Simplify expression | Suggestion |
Simplify expression | Suggestion |
Simplify expression | Suggestion |
Simplify expression | Hint |
Simplify expression | Hint |
Simplify expression | Hint |
Simplify expression | Hint |
Simplify 'IIf' | Suggestion |
Specify string comparison explicitly | Hint |
String.Compare is culture-specific (string.Compare(string, int, string, int) is culture-specific) | Warning |
String.Compare is culture-specific (string.Compare(string, int, string, int, bool) is culture-specific) | Warning |
String.Compare is culture-specific (string.Compare(string, int, string, int, bool) is culture-specific) | Warning |
String.Compare is culture-specific (string.Compare(string, string) is culture-specific) | Warning |
String.Compare is culture-specific (string.Compare(string, string, bool) is culture-specific) | Warning |
String.Compare is culture-specific (string.Compare(string, string, bool) is culture-specific) | Warning |
String.CompareTo is culture-specific | Warning |
String.EndsWith is culture-specific (string.EndsWith(string) is culture-specific) | Disabled |
String.IndexOf is culture-specific (string.IndexOf(string) is culture-specific) | Warning |
String.IndexOf is culture-specific (string.IndexOf(string, int) is culture-specific) | Warning |
String.IndexOf is culture-specific (string.IndexOf(string, int) is culture-specific) | Warning |
String.LastIndexOf is culture-specific (string.LastIndexOf(string) is culture-specific) | Warning |
String.LastIndexOf is culture-specific (string.LastIndexOf(string, int) is culture-specific) | Warning |
String.LastIndexOf is culture-specific (string.LastIndexOf(string, int) is culture-specific) | Warning |
String.StartsWith is culture-specific (string.StartsWith(string) is culture-specific) | Disabled |
try-catch and try-finally statements can be merged | Hint |
Use array creation expression | Suggestion |
Use array creation expression | Suggestion |
Use First() instead | Warning |
Use method Any() | Suggestion |
Use method Any() | Suggestion |
Use method Any() | Suggestion |
Use method Any() | Suggestion |
Use method Any() | Suggestion |
Use method IsInstanceOfType(..) | Suggestion |
Use 'TypeOf .. Is ..' operator | Suggestion |
Use 'TypeOf .. Is ..' operator | Suggestion |
Compiler Warnings (22 inspections)
Inspections in this section detect compiler warnings before you compile.Constraints Violations (2 inspections)
This category includes code inspections, mostly with the warning severity level, which detect violations related to symbol attributes, including JetBrains Rider's code annotations, and other similar issues.Inspection | Default Severity |
---|---|
Inconsistent Naming | Warning |
Namespace does not correspond to file location | Warning |
Language Usage Opportunities (4 inspections)
This category includes code inspections, mostly with the suggestion severity level, which notify you when more advanced language constructs can be used. These inspections detect syntax of outdated language versions and suggest using features from more modern language versions. For most of the supported languages, language version can be detected automatically or set manually.Inspection | Default Severity |
---|---|
Convert static method invocation to extension method call | Suggestion |
Loop can be converted into LINQ-expression | Hint |
Part of loop's body can be converted into LINQ-expression | Disabled |
Use string interpolation expression | Suggestion |
Potential Code Quality Issues (60 inspections)
This category includes inspections that detect critical issues (code smells), mostly with Error or Warning level. This category also includes inspections that ensure localization assistance.Inspection | Default Severity |
---|---|
'?:' expression has identical true and false branches | Warning |
[ThreadStatic] doesn't work with instance fields | Warning |
Abstract or virtual(overridable) event is never invoked | Suggestion |
Access to disposed closure | Warning |
Access to foreach variable in closure | Warning |
Access to modified closure | Warning |
Annotation conflict in hierarchy | Warning |
Assignment to a property of a readonly field can be useless | Warning |
Auto-property accessor is never used (non-private accessibility) | Warning |
Auto-property accessor is never used (private accessibility) | Warning |
Call to base member with implicit default parameters | Warning |
Call to 'base.Equals(...)' is reference equality | Warning |
Cannot resolve property | Error |
Cannot resolve resource | Error |
Cannot resolve resource item | Error |
Cannot resolve symbol in text argument | Warning |
Class is never instantiated (non-private accessibility) | Suggestion |
Class is never instantiated (private accessibility) | Suggestion |
Collection is never updated (non-private accessibility) | Warning |
Collection is never updated (private accessibility) | Warning |
Collection's content is never queried (non-private accessibility) | Warning |
Collection's content is never queried (private accessibility) | Warning |
Element is localizable | Warning |
Equality comparison of floating point numbers | Warning |
Event is never subscribed to (non-private accessibility) | Suggestion |
Event is never subscribed to (private accessibility) | Suggestion |
Event never invoked | Warning |
Exception rethrow possibly intended | Warning |
Function never returns | Warning |
'GC.SuppressFinalize' is invoked for type without destructor | Warning |
Impure method is called for readonly field of value type | Warning |
Iterator never returns | Warning |
Local variable hides member | Warning |
Non-accessed field (non-private accessibility) | Suggestion |
Non-accessed field (private accessibility) | Warning |
Non-readonly type member referenced in 'GetHashCode()' | Warning |
'Object.ReferenceEquals' is always false because it is called with value type | Warning |
Operator 'is'/'Type Of ... Is ...' can be used | Warning |
'out' parameter is not assigned upon exit | Warning |
Overridden GetHashCode calls base 'Object.GetHashCode()' | Warning |
Parameter hides member | Warning |
Possible incorrect implementation of Double-Check Locking pattern. Possible multiple write access to checked field | Warning |
Possible incorrect implementation of Double-Check Locking pattern. Read access to checked field | Warning |
Possible infinite inheritance | Warning |
Possible multiple enumeration of IEnumerable | Warning |
Possible write to 'Me' | Warning |
Return value of pure method is not used | Warning |
Similar expressions comparison | Warning |
Static field or auto-property in generic type | Warning |
Static member initializer refers to static member below or in other part | Warning |
String formatting method problems | Warning |
Suspicious type conversion or check | Warning |
The 'l' suffix is easily confused with the digit '1' | Warning |
Thread static field has initializer | Warning |
Type check and casts can be merged | Suggestion |
Unassigned field (non-private accessibility) | Suggestion |
Unassigned field (private accessibility) | Warning |
Unassigned readonly field | Warning |
Use format specifier in format strings | Suggestion |
'void' method is annotated by [Pure] attribute | Warning |
Redundancies in Code (22 inspections)
Code inspections in this category look for redundancies and dead code, which affect code readability and style, and could be safely removed. Some code redundancies cannot be fixed automatically, and quick-fixes for them are performed in the interactive mode, requiring the user input. But the majority of the redundancies can be fixed without user interaction, using either fix in scope or code cleanup.Inspection | Default Severity |
---|---|
Assignment is not used | Warning |
Explicit 'value' parameter declaration is redundant | Hint |
Expression is always 'true' or always 'false' | Warning |
Iterator function without 'Yield' statements | Warning |
Keyword 'Then' is redundant in multiline 'If' statement | Disabled |
Parameterless property parentheses are redundant | Hint |
Parentheses are redundant if attribute has no arguments | Hint |
Redundant array lower bound specification | Warning |
Redundant cast | Warning |
Redundant empty 'Case Else' statement | Warning |
Redundant explicit size specification in array creation | Warning |
Redundant 'Me.' qualifier | Warning |
Redundant 'MyBase.' qualifier | Warning |
Redundant 'MyClass.' qualifier | Warning |
Redundant operand in logical conditional expression | Warning |
Redundant qualifier | Warning |
Remove redundant parentheses | Disabled |
Unreachable code | Warning |
Unused import clause | Warning |
Use implicit 'ByVal' modifier | Hint |
Use implicitly typed variable declaration | Disabled |
Use implicitly typed variable declaration (evident) | Hint |
Redundancies in Symbol Declarations (25 inspections)
This category includes code inspections, mostly with the warning severity level, which detect empty and unused symbol declarations.Inspection | Default Severity |
---|---|
Class with virtual(overridable) members never inherited (non-private accessibility) | Suggestion |
Class with virtual(overridable) members never inherited (private accessibility) | Suggestion |
Local entity is only used to capture it's name | Warning |
Local function is never used | Warning |
Local function return value is never used | Warning |
Method return value is never used (non-private accessibility) | Suggestion |
Method return value is never used (private accessibility) | Warning |
Non-accessed local variable | Warning |
Parameter is only used for precondition check (non-private accessibility) | Suggestion |
Parameter is only used for precondition check (private accessibility) | Warning |
Type member is never accessed via base type (non-private accessibility) | Suggestion |
Type member is never accessed via base type (private accessibility) | Warning |
Type member is only used in overrides (non-private accessibility) | Suggestion |
Type member is only used in overrides (private accessibility) | Warning |
Type or member is never used (non-private accessibility) | Suggestion |
Type or member is never used (private accessibility) | Warning |
Unused label | Warning |
Unused local variable | Warning |
Unused parameter (non-private accessibility) | Suggestion |
Unused parameter (private accessibility) | Warning |
Unused parameter in partial method | Warning |
Unused parameter of local function | Warning |
Unused type parameter | Warning |
Virtual(overridable) member is never overridden (non-private accessibility) | Suggestion |
Virtual(overridable) member is never overridden (private accessibility) | Suggestion |