Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space ENGINES1031 and version 2020.2

...

You can prevent dotTEST from reporting specific static analysis findings by defining suppressions. Suppressions are useful when you generally follow a rule, but decide to ignore specific occurrences of the reported finding. If you do not want to receive findings for any violations of a specific rule, disable the rule in the test configuration.

Suppression schemes can be defined in source code or in a suppression file.

Defining Suppressions in Source Code

...

  • It is a good practice to specify the reason for suppression.
  • The line attribute should be used with caution as it may invalidate the suppression if the code is moved to another line when the source file is modified.

...

You can configure C/C++test to automatically suppress static rule violations that are detected on lines that match a regular expression pattern. This may be useful when you want to suppress tasks that are difficult to suppress using the in-line or in-code suppressions, such as  Qt macros.

You can specify the regex patterns by the configuring the following options in your .properties file or in the command line (see Configuration Overview):

Code Block
cpptest.result.line.suppressions.enabled=true          // Enables creating regex-based suppressions.
cpptest.result.line.suppressions.pattern=[regex;regex] // Specifies a semicolon-separated list of regex patterns.

Static rule violations that occur on lines that match the configured regex pattern(s) will be suppressed. For example, the following configuration will suppresses all findings detected on code lines that contain "Q_" anywhere on the line:

...

  • .

...

Scroll Pagebreak