JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
General

Check Methods
for codesonar_citool.py -check and codesonar_gerrit_citool.py -check

This file describes the available check methods for use with the -check option to the analyze and check forms of the codesonar_citool.py and codesonar_gerrit_citool.py commands.



Overview

The analyze and check forms of the codesonar_citool.py command have an optional -check option that you can use to specify one or more conditions on the CodeSonar analysis results. If any of the conditions are not satisfied, the codesonar_citool.py command will exit with a non-zero exit code.

The codesonar_gerrit_citool.py command extends codesonar_citool.py, so these check methods are also available with the -check option to codesonar_gerrit_citool.py analyze and codesonar_gerrit_citool.py check

There are several available check varieties. Most of these varieties inspect various properties of the warnings issued by the analysis; one variety applies to analysis alerts.

Note

Links in this page to -fail-code, -summary, and search options documentation will link to the manual page for codesonar_citool.py. The information for these options is applicable to both codesonar_citool.py and codesonar_gerrit_citool.py: it is repeated in the codesonar_gerrit_citool.py manual page for convenience only.

Other Relevant Options

The following options to codesonar_citool.py and codesonar_gerrit_citool.py are also relevant.

-fail-code Specify the exit code to return if a check fails.
-summary When specified, the exported summary will contain a section for each check specified with -check.

-check alert [+message] [+-message] [+color=colors]

Check for the presence of alerts on the analysis. Alerts may signal problems with the analysis which may make the entire analysis invalid.

Argument Default Description Can specify multiple times?
+message only alerts of the specified colors An alert message to specifically include in this check. YES
+-message none An alert message to specifically exclude from this check. YES
+color=colors RED if no +message arguments,
none otherwise
Include all alerts of the specified colors: a comma-separated list of alert color names. Accepted alert color names are: {RED, YELLOW, BLUE, GREEN}. no

Default alert check

If no explicit -check alert [...] is specified, the command will perform the default alert check, which is equivalent to:

-check alert +color=RED

Examples

-check warning [+columns=columns] [+tolerance=N] [+rows=M]

Did the analysis issue too many warnings?

Argument Default Description Can specify multiple times?
+tolerance=N 0 (zero) The check will fail if the analysis issued more than N warnings no
+columns=columns "score,class,file,lineNumber" If -summary is specified, the summary section corresponding to this check will include the specified columns in the specified order. columns is a comma-separated list of column names. Accepted column names are: { id, class, score, file, lineNumber, procedure}.
If -summary is not specified, this argument has no effect.
no
+rows=M 10 If -summary is specified, the summary section corresponding to this check will include a maximum of M rows.
If -summary is not specified, this argument has no effect.
no

Examples

-check warning-class [+class] [+tolerance=N] [+rows=M]

Did the analysis issue too many warnings of the specified warning classes?

Argument Default Description Can specify multiple times?
+class all warning classes are considered Name of a warning class to include when counting warnings for this check. YES
+tolerance=N 0 (zero) The check will fail if the analysis issued more than N warnings of the specified warning classes.
If any search options are specified, this count considers only warnings that meet the specified search conditions.
no
+rows=M unlimited If -summary is specified, the summary section corresponding to this check will include a maximum of M rows.
If -summary is not specified, this argument has no effect.
no

Examples

-check warning-priority [+priority] [+tolerance=N]

Did the analysis issue too many warnings with the specified priorities?

Argument Default Description Can specify multiple times?
+priority "P0: High" Name of a warning priority to include when counting warnings for this check. The specified priority must be the name of a priority that is defined on the hub. YES
+tolerance=N 0 (zero) The check will fail if the analysis issued more than N warnings with one of the specified priorities.
If any search options are specified, this count considers only warnings that meet the specified search conditions.
no

Examples

-check warning-severity [+severity] [+scale=scale] [+tolerance=N]

Did the analysis issue too many warnings with scores in the specified severity classes?

Argument Default Description Can specify multiple times?
+severity High Name of a severity class to include when counting warnings for this check. With the default +scale setting, the available classes are {High, Medium, Low}. YES
+scale=scale "Low:21:Medium:56:High" Defines the set of severity classes to use for this check, as a list of severity class names alternating with warning score threshold values separated by a colon (:). The default setting specifies that "Low" severity class contains warnings with score 0-21, "Medium" is 21-56, and "High" is 56-100. no
+tolerance=N 0 (zero) The check will fail if the analysis issued more than N warnings with scores that fall into the specified severity classes.
If any search options are specified, this count considers only warnings that meet the specified search conditions.
no

Examples

 

To report problems with this documentation, please visit https://support.codesecure.com/.