Skip to main content

Code Analysis

  • 3 minutes to read

CodeRush Classic provides a powerful code analysis tool. It finds issues in your code and marks them with indicators to the left of the appropriate line and to the right of the vertical scroll bar. Hint, Warning and Error issues are underlined with colored wavy lines as well. Dead Code issues are colored gray. Click the appropriate right-spaced indicator to move the cursor to an issue, even if it is beyond the editor’s bounds.

The information on each issue is contained in an appropriate Code Fix hint. This hint is shown when you place the mouse pointer over the underlined code or over the appropriate indicator (see animation).

CodeIssuesShow

You can view all issues found in you solution in a single window. Choose DevExpress|CodeRush |Tool Windows|Code Issues to open the Code Issues tool window.

Note

To show all issues of the entire solution, the Enable solution wide analysis option on the Code Issues options page should be enabled. Otherwise, the tool window shows only code issues contained in the current file.

If a code provider or a refactoring can be used to eliminate an issue, CodeRush Classic enables you to do it with a single click.

CodeIssueElliminate

Code issues are marked with different colors. Each color corresponds to a certain issue type. The following issue types are available.

Color Icon Name Description
Blue ci_Hint Hint The code is valid, but can be improved slightly. For instance, a variable initialization that can be moved to the declaration.
Orange ci_Warning Warning The code is valid, but is useless. For instance, it contains an unimplemented class member.
Red ci_Error Error The code is invalid. For instance, it contains a call to an undeclared method.
Green ci_CodeSmell CodeSmell The code is valid, but is unreadable. For instance, a method is too complex.
Gray ci_DeadCode DeadCode Unused code. For instance, it contains a declared variable whose value is never returned.
Purple ci_DuplicateCode Duplicate Code The solution contains several similar code blocks that can be consolidated into a single method.

The Document Status Indicator is situated in the right-top corner of the editor. It shows whether the current file contains issues. Here are the various ways the indicator may look.

Icon Description
NoIssues The current document does not contain Hint, Warning, or Error issues.
ci_Hint The current file contains Hint issues.
ci_Warning The current file contains Hint and Warning issues.
ci_Error The current file contains Hint, Warning and Error issues.

If a background duplicate code search is enabled, one of the following duplicate code icons is shown in the right-bottom corner of the code editor.

Icon Description
ci_DuplicateCode CodeRush Classic has found duplicate code in the current solution.
ci_NoDuplicates CodeRush Classic has not found duplicates.

You can enable or disable Code Issues from the Code Issues options page or from the CodeRush Classic tool bar.

See the Code Issues topic for the complete list of available code issues.

Note

This product is designed for outdated versions of Visual Studio. Although Visual Studio 2015 is supported, consider using the CodeRush extension with Visual Studio 2015 or higher.