ReSharper Web Help

The basic means of configuring ReSharper code inspections are switching code analysis on and off, excluding files and folders from code analysis, and excluding files and regions with auto-generated code. However, you can configure code inspections in other ways.

Where ReSharper executes its own code inspections (as opposed to compiler errors and warnings), you can specify whether to display them as errors, warnings, suggestions, hints, or not to display at all.

That is, by changing severity level you can get rid of issues that seem trivial or being of no interest. For example, you can force ReSharper to display warnings as errors or suggestions, or even not show them at all. In a similar way, what is initially considered a suggestion can be displayed as a warning or error, or be hidden.

 Note

Compiler errors and warnings that ReSharper highlights are not configurable the way that ReSharper's own inspections are. However, with some compiler warnings, you can use #pragma directives to suppress them. Look for this action in the list of ReSharper's Action List upon a specific warning.

To change severity level of code inspections
  1. On the main menu, choose ReSharper | Options.
  2. Select Code Inspection | Settings.
  3. Make sure that Enable code analysis is selected.
  4. Open the Code Inspection | Inspection Severity page.
  5. In the Inspection Severity page, you can view inspection settings for all languages in the All tab or choose a particular language tab to view only settings related to this language.
  6. Select an inspection whose severity you want to modify.
  7. Click the drop-down list to the right of the selected entry, and choose one of five standard display options:
  8. Click Save to apply the modifications and let ReSharper choose the settings layer, or choose a particular settings layer in the Save To drop-down list. To learn more about saving ReSharper settings, see JetBrains .NET Tools Blog: Save or Save To in ReSharper Options.

You can also access inspection severity options right from the actions list.

To change inspection severity from the text editor
  1. Set the caret to a code issue highlighted by a ReSharper's inspection.
  2. Press Alt+Enter to open the actions list for this inspection.
  3. In the actions list, choose Inspection options for [name of inspection] > Inspection options for [name of inspection] :
  4. In the Inspection Options dialog box that appears, you check the current severity level of the inspection and change it if necessary.
  5. Click Save to apply the modifications and let ReSharper choose the settings layer, or choose a particular settings layer in the Save To drop-down list. To learn more about saving ReSharper settings, see JetBrains .NET Tools Blog: Save or Save To in ReSharper Options.

ReSharper allows you to suppress inspections in a particular piece of code by using disable [inspection alias] and restore [inspection alias] keywords in comments. All inspection that match the alias will be suppressed between such comments.

To suppress code inspections with comments
  1. Set the caret to a code issue highlighted by a ReSharper's inspection.
  2. Press Alt+Enter to open the actions list for this inspection.
  3. In the actions list, choose Inspection options for [name of inspection] > Suppress inspection [name of inspection] with comment :
  4. ReSharper inserts the corresponding comment lines before and after the code issue.

    If necessary, you can move these comments to other places in the file so that several issues of this type could be suppressed.

See Also

Concepts

Procedures

Reference

External Links