This topic explains how to suppress Parasoft findings using in an IDE. See Suppressing the Reporting of Findings for information about manually suppressing findings in source code or a suppression file.

In this section:

Adding Suppressions

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.

  1. Right-click on a single finding or a group of selected findings and choose Suppress from the menu.

  2.  Choose where the suppressions will be stored. You can select one of the following options:

    • In source code - The selected finding will be suppressed in code and shared across the team when checked in your source control system.
    • Locally in file - The suppression will be stored in a parasoft.suppress file located in the same location as the corresponding source file. See In-file Suppressions for details.
    • On DTP- The suppression will be stored on DTP and shared with the team. You can only suppress findings that are already registered on DTP.

    Suppressing Findings on DTP

    The 'On DTP' option is only available for findings that have been imported from DTP (see Importing Findings). The selected findings will be instantly removed from the Findings view and suppressed after the subsequent analysis run. 

  3. Enter a reason for suppressing the finding.

  4. Click OK to complete the suppression.

In-file Suppressions

If you choose to store a suppression in a file, it will be stored in a parasoft.suppress file created in the same location as the source file that contains the finding. When you add a suppression, the file automatically opens in the IDE editor. The contents of the file may resemble the following:

suppression-begin
file: Simple.java
rule-id: UC.AUL
message: Avoid unused label: case10
reason: verified
author: annstu
suppression-end

suppression-begin
file: Account.java
rule-id: PB.TYPO.TLS
message: Text label 'case10' may be a typo for 'case 10'
reason: verified
author: annstu
suppression-end
See Defining Suppressions in Suppression Files for details about the suppression format and the complete list of available attributes.

Newly created suppression files are automatically added to your project and are displayed in the IDE file tree with other project files.

If you use a source control system to track changes in source code, we recommend that you check in parasoft.suppress files to share your suppressions across the team.

Migrating suppressions

If your workspace contains suppressions that were created with older versions of Jtest, you may be prompted to convert suppressions in the deprecated XML-style format into in-file suppressions. Conversion has the following consequences:

  • Suppressions in the deprecated format are converted into plain text and saved in parasoft.suppress files located in the same location as the corresponding source file.
  • A backup file that contains suppressions in the deprecated format is created. The location of the file is printed to the console.
  • Suppressions in the deprecated format are removed from the workspace.

Suppressions associated with files that are not available the workspace are not converted. The list of unconverted suppressions is printed on the console.

If you should want to restore deprecated suppressions from the backup file:

  1. Close your IDE.
  2. Go to the location where the backup file is stored (the location is printed to the console). It contains a 'jtest' directory and a local_suppressions_backup.zip file.

  3. Remove the existing'jtest' directory.

  4. Extract the contents of local_suppressions_backup.zip to the same location. A new 'jtest' directory that contains restored suppressions will be created.

You can re-migrate restored suppressions on next IDE startup.

Reviewing Suppressions

You can review suppressed findings and unsuppress the findings that have been saved locally on desktop. 

  1. Click Parasoft in the menu bar, choose Preferences (Eclipse) or Settings (IntelliJ),select Import Findings and Coverage and enable the Suppressed findings option (see Customizing Import Options for details).

  2.  Open the Findings view, choose Configure Contents from the menu and enable the Suppressed findings option (see Customizing the Findings View for details).

  3. Run analysis or import findings (see Importing Findings). The suppressed findings will be displayed in the Findings view.

  4. You can right-click a finding and choose the Go To option to view the code that triggered the finding.

Removing Suppressions

You can remove suppression of a previously suppressed finding.

  • Suppressions that are stored in code can be removed manually from your code.
  • Suppressions that are stored in files can be removed by deleting a selected entry from a parasoft.suppress file (see In-file Suppressions).
  • Suppressions that are stored on DTP can be removed by right-clicking on a finding or a set of selected findings and choosing Unsuppress on DTP from the menu.

    Findings will be unsuppressed in the subsequent analysis run.


  • No labels