This topic explains how to prevent SOAtest from reporting specific static analysis violations (e.g., when you generally follow a rule, but decide to ignore that rule in an isolated number of exceptional situations). Suppression schemes can be entered in the GUI or defined directly in the source code.

Sections include:

About Suppressions

Suppressions are used to prevent SOAtest from reporting additional occurrences of a specific static analysis task (multiple tasks might be reported for a single rule). Suppressed messages will be sent to a special Suppressions view instead of the Quality Tasks view; this allows you to monitor those violations as needed while keeping your main results areas focused on the other errors.

You use suppressions for situations when you generally want to follow a rule, but decide to ignore that rule in an isolated number of exceptional situations. With suppressions, you can continue checking whether your code follows that rule without receiving repeated messages about your intentional rule violations. If you do not want to receive error messages for any violations of a specific rule, we recommend that you modify your Test Configurations so that they no longer check that rule.

Note that suppression settings are independent of Test Configurations. To avoid confusion, keep in mind that:

  • The Test Configuration defines the set of rules that are checked during static analysis.
  • Suppressions define which static analysisre sults should be visible in Quality Tasks view and reports.

This means that rules selected in the Test Configuration will be checked during analysis, but results that match the suppression criteria will not be displayed. 

 

Suppressions are message-based and not rule-based

Suppressions prevent the reporting of a specific static analysis task (e.g., fix the violation of rule X that occurs in line Y); they do not prevent the reporting of all violations of a rule. 

Defining Suppressions

To suppress a static analysis task that is shown in the Quality Tasks view:

  1. Right-click the Quality Tasks view item that represents the task you want to suppress, then choose Suppress Task from the shortcut menu.
    • To suppress all tasks in a group (a rule category, a specific rule, a file, etc.) right-click the node that represents that group, then choose Suppress All Tasks.
  2. Enter the reason for the suppression in the dialog box that opens

The task will then be "suppressed" and removed from the Quality Tasks view. A suppression entry will be added to the Suppressions view. If the same static analysis violation is found in subsequent tests of this project, it will be reported in the Suppressions view, but not in the Quality Tasks view.

Viewing Suppressions

To view the suppressed messages that were reported in a subsequent test run:

  • Open the Suppressions view. If this view is not available, choose Parasoft> Show View> Suppressions to open it.

The Suppression Messages view will display the following information:

  • The static analysis violation that was suppressed.
  • The reason why the task was suppressed.
  • The resource (file) to which the suppression applies.
  • The folder that contains the resource.
  • The name of the person who suppressed the task.
  • The date on which the suppression was first applied.

To sort the Suppressions view contents by one of the column headings, click that column heading.

 

You can edit a suppression’s message or reason

Right-click the suppression in the Suppressions view, choose Edit Message or Edit Reason from the shortcut menu that opens, and modify the message or reason in the dialog that opens.

Using the Suppression Filter to Restrict the Suppressions Shown

You can restrict which suppressions are shown in the Suppressions view by using the available suppressions filter. 

To filter the suppressions shown in the Suppressions view:

  1. Click the Filter button in the Suppressions view toolbar. The Filters dialog will open.
  2. Check the Enabled check box to enable the filter.
  3. Use the dialog’s controls to specify your filtering criteria. Available options include:
    • Limit visible items to: Shows no more than the specified number of suppressions.
    • On any resources: Shows all suppressions for all projects.
    • On any resource in same project: Shows all suppressions for the currently-selected project.
    • On selected resource only: Shows only the suppressions entered for the currently-selected resource.
    • On selected resource only and its children: Shows only the suppressions entered for the currently-selected resource, and that resource’s children.

Clearing Suppressions

Select the suppression you want to remove and click the Red X Remove Suppression icon in the top right of the view.

If this same static analysis violation is found in subsequent tests of this project, the task will be reported in the Quality Tasks view.

  • No labels