Home > Code Analysis > Code Issues fixes and suppression

Code Issues fixes and suppression

July 25th, 2011

Code Issues can be easily fixed with the corresponding code fixes. The code fixes are operations that allow you to automatically fix the issue by changing the source code, so the issue is no longer valid for the block of code in question. The code fixes are refactoring or code providers assigned to the code issues as fixes.

There are several ways to fix an issue:

  1. Code Fix hint
  2. Zoom Window
  3. Manually apply a fix

Code Fix hint

The hint shows not only the list of code issues, but when you hover the mouse over the issue highlighted in the code editor, available code fixes. You can also see this hint when hovering over the left view bar. Clicking the link with the name of the code fix will automatically fix the issue. Hovering over a link will also show you a preview hint of changes being made after the fix is applied.

CodeRush Code Fix hint with highlighted fix

Zoom Window

This window appears when you hover the mouse over the marks on the right document bar. The window behaves as a container of several Code Fix hints. Clicking the link works similarly to the Code Fix hint.

CodeRush Zoom Window with hints and fixes

Manual Fixes

The fix for an issue can be applied the same way as all other refactoring and/or code operations. For example, from the Refactor!/Code! popup menu:

DXCore Refactor Code popup menu

Issues Suppression

If you don’t like some of the issues or don’t want them to appear in a specific source code, you can easily suppress them for different scopes, such as:

  • Solution
  • Project
  • File

You can also completely disable the issue. If you have disabled the issue, you can reenable it on the code issues Catalog options page:

CodeRush Code Issues Catalog options page

To suppress an issue, click the blue triangle on the code fix hint, after which the Suppression menu appears with several options available:

CodeRush Code Fix hint with the Suppression menu

Once you have suppressed the issue, you are able to restore it on the Editor | Code Analysis | Issue Suppression options page:

CodeRush Issue Suppression options page

Here, you can see the list of previously suppressed code issues and remove them from this list. After they are removed, they appear again in the source code if appropriate. On this options page, you can also change the suppression scope for the specific code issue.

The suppression settings are individual for every solution and are stored near the solution cache.

This post is a part of post series about CodeRush Code Issues technology. To learn more about code issues, please refer to the appropriate topics:

  1. Code Issues technology overview
  2. Code Issues types overview
  3. Code Issues visual presentation
  4. Code Issues fixes and suppression (current post)
  5. Code Issues navigation techniques
  6. Code Issues tool window
  7. Code Issues configuration and options
  8. Code Issues overall list
  9. Creating your own code issue
Products: CodeRush Pro
Versions: 11.1 and up
VS IDEs: any
Updated: Jul/25/2011
ID: C117

Similar Posts:

  1. Przemyslaw Wlodarczak
    July 26th, 2011 at 00:10 | #1

    “Promote to Generic: string” – 11.2 sneak peak? 😉

  2. July 26th, 2011 at 01:13 | #2

    @Przemyslaw Wlodarczak
    Not really, this one is pretty old and is still waiting for its time :-)