In this section:
Suppressing Findings in the IDE
You can suppress individual instances of findings, all instances of a finding type in a file, or all findings in the file from the Findings view.
Right-click on a single finding or a group of selected findings and choose Suppress from the menu.
Enter a reason for suppressing the finding and choose where the suppression will be stored.
You can select one of the following storage options:
- Locally on desktop - The suppressions will be stored in your workspace or solution and used only during local analysis runs. If you select this option, it will suppress all occurrences of the selected finding in the file (the number of occurrences will be displayed in the dialog box).You can configure the custom location for storing local suppression with the suppression.local.dir option; see Configuration in Automation User Guide for details.
- On Development Testing Platform - The suppressions will be stored in Development Testing Platform and shared with the team. You can suppress only findings that are already registered on DTP.
- In source code - The findings will be suppressed in code and shared across the team when checked in your source control system.
You can review suppressed findings and unsuppress the findings that have been saved locally on desktop.
Click Parasoft in the menu bar, choose Options (Visual Studio) or Preferences (Eclipse), select Import Findings and Coverage and enable the Suppressed findings from local analysis or file option (see Customizing Import Options for details).
Open the DTP Findings view, choose Configure Contents from the menu and enable the Suppressed findings option (see Customizing the Findings View for details).
- Run analysis or import findings (see Importing Findings). The suppressed findings will be displayed in the DTP Findings view.
- You can right-click a finding and choose the Go To option to view the code that triggered the finding.
- Unsuppress findings if necessary. Suppressions that are saved in the code need to be unsuppressed manually in the code. Suppressions stored in DTP can be unsuppressed in DTP. To unsupress locally suppressed findings, right-click on a finding or a group of selected findings and choose Unsuppress locally... from the menu:
Manually Suppressing Findings in Source Code
C++test allows you to define suppressions directly in the source code, using the following directives embedded in C or C++ style comments: Example A:
line *, line 10, line 50-*
class MyClass, class *
file *example.cpp, file *ex*.cpp
reason "Not relevant to my code."
The above elements (
line, class, file, etc.) can be combined together by separating each entry with a space (for example,
item * class MyClass line 10-*).
<filenamewildcard> must be specified as an absolute path to a file.
/* parasoft suppress item SECURITY-02 */
This suppresses reporting of violations reported by the SECURITY-02 rule in the current file, starting from the line where the suppression is located.
/* parasoft unsuppress item * class MyClass line 10-* */
This unsuppresses all items for class MyClass in the current file starting from line 10.
/* parasoft unsuppress item SECURITY-02 file *example.cpp
This removes the suppression of reporting of violations reported by the SECURITY-02 rule in the current filein any file that is in the current compilation unit and has a file path that matches the *example.cpp file name pattern.
/* parasoft suppress all */
This suppresses all messages in the current file starting from the line where this directive was entered.
void foo(); /* parasoft-suppress SECURITY-02 */
void bar(); // parasoft-suppress SECURITY-03 "Not relevant to my code."
This suppresses item SECURITY-02 on the line with "foo" declaration and item SECURITY-03 on the line with "bar" declaration with the reason "Not relevant to my code."
/* parasoft off */
/* parasoft unsuppress line 30-45 */
This suppresses everything, then unsuppress lines 30 to 45.
item is specified, the (un)suppression will be applied to all rules. This is equivalent to specifying
file is specified, the (un)suppression will be applied only to the current file.
line is specified, the (un)suppression will be applied starting from the line that contains the directive.
parasoft suppress file "*file with whitespace.cpp"
file * pattern in a header file makes it valid for all the files that include that header file. When no file is specified, suppression will be applied only to that header.
parasoft-suppress directive is quite distinct from the other
parasoft on, parasoft off, and
parasoft suppress/unsuppress directives.
parasoft-suppress suppresses only the current line (the line with the directive) and uses different syntax than the other directives.
C++test allows you to define suppressions directly in the source code, using the following directives embedded in C or C++ style comments: