RubyMine 6.3.0 Web Help

For some reasons, you may want to partly disable a specific inspection, i.e. ignore some code issues while continue to detect other issues with this inspection. For example, RubyMine considers some code to be "dead" and you can see that it is true. The inspection is helpful and you do not want to disable it. However, you may want to use this code later and do not want it to be highlighted in the editor or appear in the issue reports. To do so, RubyMine allows you to suppress certain inspections for a specific statement, function/method, tag or file. You can do it either in the editor, using the suggestion list or in the Inspection tool window when analysing inspection results.

Note

Some code inspections (e.g. those detecting errors) cannot be suppressed.

Note

Note again the difference between suppressing and disabling code inspections: By 'suppressing' an inspection, RubyMine inserts a special comments that tell the code analysis engine to ignore the issues found by the inspection in a specific piece of code. By 'disabling' an inspection, you just turn it off so the code analysis engine stops ignores all code issues.

To suppress inspection in the editor
  1. Set the cursor to the highlighted code issue in the editor.
  2. Press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt+EnterAlt EnterAlt EnterCommand 1Alt Enter, or click the light bulb icon intentionBulb to expand the suggestion list.
  3. Depending on the issue, you will see either quick-fixes related to the inspection ot the Inspection "<inspection name>" options item.
  4. Use the up/down arrow keys to select this item and then press the right arrow key or just click the right arrow rightArrowInMenu next to this item.

    Note

    Pressing the left arrow key, or EscapeEscapeEscapeEscapeEscape, Escape or Ctrl+GEscapeEscapeEscapeEscapeEscapeEscapeEscapeEscape hides the suggestion list.

  5. In the inspection options list, select the desired suppress action:

    ruby_suppressInspection.png

    The inspection will be suppressed with special comments in the corresponding piece of code.
To suppress an inspection from the inspection results
  1. After running code analysis, select a code issue, for which you want to suppress the inspection, in the Inspection tool window.
  2. Click the img button on the toolbar, or just right-click the selected inspection.
  3. Choose the desired suppress action. For example:

    ruby_suppressInspectionFromToolWindow.png

    The inspection will be suppressed with special comments in the corresponding piece of code.
2.0+

Note

The set of suppress actions depends on the language to which inspection applies. For example, for Cucumber, one can suppress inspections for a whole feature, for a scenario, or for a particular step:

ruby_suppressInspectionCucumber.png

See Also

Concepts:

Procedures:

Reference:

Web Resources: