Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Collapse]CodeRush
  System Requirements
 [Expand]Features by Language
 [Expand]Getting Started
 [Expand]Coding Assistance
 [Expand]Navigation and Search Tools
 [Collapse]Static Code Analysis
  [Expand]Analyzers Library
   Code Metrics
   Spell Checker
  Visualization Tools
 [Expand]Code Style Assistance
  Building Assistance
  Debugging Assistance
 [Expand]Refactoring Assistance
 [Expand]Unit Testing Assistance
 [Expand]Decompiling Tools
 [Expand]Configuration Options
 [Expand]Extensibility
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Static Code Analysis

CodeRush provides a powerful static analysis tool. It detects possible issues in your code and helps you correct them. The list of supported issue types is available in the Analyzers Library article.

You can analyze your code using these two approaches:

Expanded Code Issues window

The Code Issues window is designed to simplify the static analysis process. Open the CodeRush | Code Analysis menu and choose the Code Issues menu item to invoke the Code Issues window.

The Code Issues window supports two operation modes:

  • CodeRush Diagnostics — performs analysis using the Analyzers Library
  • Visual Studio Diagnostics — performs the Visual Studio built-in code analysis

The Analyzer Set Selector on the toolbar allows you to switch between these modes. To analyze a current solution using the specified set of analyzers, use the Refresh button. You can export a report to plain text or an XML file using the Export toolbar button.

Note

If your solution is very large, the analyzing process may take significant time. In this case, consider running Static Code Analysis for the active project or file only. Use the CodeRush | Code Analysis | Analyze Active Project or Analyze Active Document menu items for this.

Expanded Background Analysis

The CodeRush Diagnostics are integrated into Visual Studio, which enables you to analyze your code on the fly.

If you prefer to see code issues instantly in the Error List window, enable the Background Analysis on the Editor | All Languages | Static Code Analysis options page. This options page can be accessed using the CodeRush | Code Analysis | Configure... Visual Studio menu item.

Note

Background Analysis is a resource-demanding feature. Use it with caution on large solutions.

Expanded Analyzer Suppression

You can suppress certain Analyzers using the Code Actions Menu invoked on a line of code with a Code Issue.

There are two types of suppression:

  • In Source — Suppresses a single issue locally using the #pragma warning disable directive.
  • In Suppression File — Creates or supplements the GlobalSuppressions.cs file with the SuppressMessage attribute. This type of suppression works only for members and broader scopes. Refer to the In Source Suppression Overview article to learn more.

The analyzer set for Visual Studio's Error List window can be configured for the entire project. You can disable some analyzers permanently or change their severity. Right-click <Your project> | References | Analyzers in the Solution Explorer to configure the project's analyzer set.

How would you rate this topic?​​​​​​​