Suppress rule violations

Suppression of code review rule violations means that a rule or a group of rules is ignored for a selected script or its parts. You can enter a comment to suppress a violation manually, or you can use the Code Editor pop-up menu to add it automatically.
Syntax used to suppress violations:
  • -- {CA - all}
    suppressing directive that applies suppression of all rules.
  • -- {CA - <RuleID>}
    suppressing directive that applies suppression for the indicated rules. Enter the ID numbers of rules that you would like to suppress separated by a comma
  • -- {CA + all}
    resuming directive that removes the applied suppression
Each next opening attribute cancels the previous one.
To suppress rule violations automatically
1
In the Code Editor, select a script or its part for which you would like to apply suppression.
2
Right-click the selected code, and click Add Rule Suppression Comment. The Select Code Review Rules to Suppress Violations window opens.
3
Use the check boxes to select the rules that should be suppressed, and click OK.
4
Re-analyze the script for the changes to take affect.
5
The lines of code for which the suppression is applied will be highlighted in a different color.
To suppress violations manually
1
In the Code Editor, enter an opening attribute at the beginning of a whole script or before the necessary piece of code.
2
If the suppression should be applied not till the end of a script, but only to its part, enter a closing attribute after the last line of a necessary piece of code.
3
Re-analyze the script for the changes to take affect.
4
The lines of code for which the suppression is applied will be highlighted in a different color.
Suppressed lines of code are highlighted in a different color after re-analyzing the script. The highlight is removed once the selected code is modified. Set a color for suppressed lines of code at File > Preferences > Code Editor > Display > Highlight lines of code with suppressed Code Review Rules.

On the Code Review tab of the Script Analyzer, line numbers and violation details of suppressed rules are shown with a strikethrough. The total number of suppressed rules for the selected piece of code is shown on the status bar of the Code Editor.
This document was last updated on February 20, 2020
Helpful?