Skip to main content

Analyzers Library

  • 5 minutes to read

The CodeRush Server Analyze task uses CodeRush Code Analyzers library to inspect the source code.

The following table lists the available code analyzers:

ID Description C# VB
Code Complexity Analysis
CRR0001 The binary operation for identical sub-expressions may contain a redundant expression. CRR_IconPassed CRR_IconPassed
CRR0004 Both ternary expression branches appear to be identical. CRR_IconPassed CRR_IconPassed
CRR0009 The conditional expression in the if-statement can be combined with the next one. CRR_IconPassed CRR_IconPassed
CRR0012 The logical OR expression has opposite terms. Check both operands to make sure they are expressed as intended. CRR_IconPassed CRR_IconPassed
CRR0015 The logical OR operation in the expression may be redundant. CRR_IconPassed CRR_IconPassed
CRR0019 The expression contains at least one expression that is a logical subset of another. CRR_IconPassed CRR_IconPassed
CRR0024 The number appears to be a low-precision version of a common constant. Consider changing the number to the suggested reference. CRR_IconPassed CRR_IconPassed
CRR0047 The type can be moved to a separate file CRR_IconPassed CRR_IconPassed
CRR0049 Environment.NewLine can be used. Convert the "\r\n" string value to an Environment.NewLine call. CRR_IconPassed CRR_IconPassed
CRR0050 String.Compare can be used. Use the String.Compare() instead of the == operator or "!=" operator. CRR_IconPassed CRR_IconPassed
CRR0051 String.IsNullOrEmpty can be used. Use the string.IsNullOrEmpty method call instead of an expression. CRR_IconPassed CRR_IconPassed
CRR0052 String interpolation can be used. Convert an expression into string interpolation. CRR_IconPassed CRR_IconPassed
Mistake Detection
CRR0002 The for-loop's condition expression may use an incorrect variable. CRR_IconPassed
CRR0003 The for-loop's iterator section may use an incorrect variable. CRR_IconPassed
CRR0006 The null comparison that follows the typecast may reference an incorrect variable. CRR_IconPassed CRR_IconPassed
CRR0007 The string.Format arguments may not match specified format items. CRR_IconPassed CRR_IconPassed
CRR0013 The method's return statements appear to always return the same constant value. CRR_IconPassed CRR_IconPassed
CRR0017 The expression contains a variable that is checked for null after it is referenced. CRR_IconPassed CRR_IconPassed
CRR0020 The divide-by-integral operation internally casts to the integral type and rounding a floating point value may produce unexpected results. CRR_IconPassed CRR_IconPassed
CRR0027 The expression is not checked for null and can cause a System.NullReferenceException exception. CRR_IconPassed CRR_IconPassed
CRR0028 This event handler is empty and can be deleted. CRR_IconPassed CRR_IconPassed
CRR0040 The code element exceeds the specified metric threshold. CRR_IconPassed CRR_IconPassed
CRR0048 The type name does not correspond to the file name CRR_IconPassed CRR_IconPassed
CRR1000 The name of the declaration contradicts the existing naming conventions. Use a different name or add a new naming rule. CRR_IconPassed CRR_IconPassed
Async/Await
CRR0029 You should always call the ConfigureAwait() explicitly because the default behavior may cause a deadlock and should be changed in most cases. CRR_IconPassed CRR_IconPassed
CRR0030 You can delete the await keyword. CRR_IconPassed CRR_IconPassed
CRR0031 The returned Task should never be null, use Task.FromResult() instead. CRR_IconPassed CRR_IconPassed
CRR0033 The async method which returns nothing should be in a try/catch block. Otherwise, that method's exceptions may cause a crash. CRR_IconPassed CRR_IconPassed
CRR0034 The async method should contain the "async" suffix CRR_IconPassed CRR_IconPassed
CRR0035 The async method has no CancellationToken parameter. CRR_IconPassed CRR_IconPassed
CRR0036 The await keyword is not required for the Task.FromResult expression. CRR_IconPassed CRR_IconPassed
CRR0037 Use the Task.When instead of Task.Wait method in an async method. CRR_IconPassed CRR_IconPassed
CRR0038 You should use the CancellationToken in the async method's body to break the task if cancellation is requested. CRR_IconPassed CRR_IconPassed
CRR0039 The cancellation token should be passed into the await expression. CRR_IconPassed CRR_IconPassed
CRR0041 You should use the Task.Run method instead. CRR_IconPassed CRR_IconPassed
Unused Code Detection
CRR0005 An expression always resolves to the same value. CRR_IconPassed CRR_IconPassed
CRR0008 Both if statement child blocks appear to be identical. CRR_IconPassed CRR_IconPassed
CRR0010 Precede the instantiation with the throw keyword if you want to throw an exception (so other parts of the program can catch it). CRR_IconPassed CRR_IconPassed
CRR0011 The next if-statement has the same condition as the current one. However, this if-statement breaks the program flow and exits the method block. The next if-statement's body is never reached. CRR_IconPassed CRR_IconPassed
CRR0014 The variable receives two assignments in succession. The first assignment may not be needed. CRR_IconPassed CRR_IconPassed
CRR0016 The method call's return value is not used. This may be unintentional. CRR_IconPassed CRR_IconPassed
CRR0018 The assignment reversal is unusual and may be an attempt to bypass side-effects occurring between two assignment statements. This may also indicate brittle code, which cannot be easily maintained. CRR_IconPassed CRR_IconPassed
CRR0021 Nested if-else conditions are equivalent. The code in the nested if-block may never be reached. CRR_IconPassed CRR_IconPassed
CRR0022 The conditional expression appears to always evaluate to false. You should check the conditionals above for similar expressions that would prevent the current conditional from being evaluated to true. CRR_IconPassed CRR_IconPassed
CRR0023 The conditional expression appears to always evaluate to true. The conditional expressions above are likely to ensure that this conditional never evaluates to false. CRR_IconPassed CRR_IconPassed
CRR0025 The inverse of the current expression appears to be already satisfied in a parent conditional, so this expression likely always resolves to false (rendering its code block is never reached). CRR_IconPassed CRR_IconPassed
CRR0026 The member is never used and can be deleted. CRR_IconPassed CRR_IconPassed
CRR0042 This parameter is never used and can be deleted. CRR_IconPassed CRR_IconPassed
CRR0043 This type is not used and can be deleted. CRR_IconPassed CRR_IconPassed
CRR0044 The local variable is never used and can be deleted. CRR_IconPassed CRR_IconPassed
CRR0045 The local variable is never used and can be replaced with a discard. CRR_IconPassed CRR_IconPassed
CRR0046 Remove the redundant initialization to improve code readability. CRR_IconPassed CRR_IconPassed
Spell Check
CRRSP02 A repeated word has been found. CRR_IconPassed CRR_IconPassed
CRRSP03 A misspelled word has been found in the file name. CRR_IconPassed CRR_IconPassed
CRRSP04 A misspelled word has been found in the XML documentation comment. CRR_IconPassed CRR_IconPassed
CRRSP05 A misspelled word has been found in the comment. CRR_IconPassed CRR_IconPassed
CRRSP06 A misspelled word has been found in the string. CRR_IconPassed CRR_IconPassed
CRRSP07 A misspelled word has been found in the verbatim string. CRR_IconPassed CRR_IconPassed
CRRSP08 A misspelled word has been found in the public identifier. CRR_IconPassed CRR_IconPassed
CRRSP09 A misspelled word has been found in the internal identifier. CRR_IconPassed CRR_IconPassed
CRRSP10 A misspelled word has been found in the protected internal identifier. CRR_IconPassed CRR_IconPassed
CRRSP11 A misspelled word has been found in the protected identifier. CRR_IconPassed CRR_IconPassed
CRRSP12 A misspelled word has been found in the private identifier. CRR_IconPassed CRR_IconPassed
CRRSP13 A misspelled word has been found in the local identifier. CRR_IconPassed CRR_IconPassed