Main Content

Check guidelines (-guidelines)

Check for violations of Guidelines

Since R2021a

Description

This option affects Bug Finder only.

Specify whether to check for violations of Guidelines. Each option value corresponds to a subset of guidelines to check.

Set Option

User interface (desktop products only): In your project configuration, the option is on the Coding Standards & Code Metrics node.

User interface (Polyspace Platform, desktop products only): This option does not exist in the project configuration. Activate checkers by using the options Use custom checkers file and Checkers activation file (-checkers-activation-file).

Command line and options file: Use the option -guidelines. See Command-Line Information.

Why Use This Option

Guidelines are customizable checkers that check for violation of coding best practices. You can use this option to specify the subset of Guidelines rules that matches your requirements.

After analysis, the Results List pane lists the violations. On the Source pane, for every violation, Polyspace® assigns a symbol to the keyword or identifier relevant to the violation.

Settings

all

Check for violations of all Guidelines rules using default thresholds.

See Guidelines.

his

Check for violations of software complexity metrics standards specified in the Hersteller Initiative Software (HIS) standard. See HIS Code Complexity Metrics.

The HIS standard recommends specific thresholds for a subset of the software complexity checkers. When you use the input his, Polyspace activates this subset of software complexity checkers and uses their HIS recommended threshold. Polyspace raises a violation if a software complexity metric exceeds the HIS recommended threshold.

from-file

Specify an XML file where you configure a custom selection of Guidelines checkers that have specific thresholds. When running an analysis on Polyspace Desktop, create or edit an XML file that contains your checker configuration by using the Desktop User Interface. When running an analysis on Polyspace Server, edit an existing checker selection file. When running an analysis on Polyspace as You Code, create or edit an XML file that contains your checker configuration by using the Checkers Selection User interface.

When using the value from-file, use the option Set checkers by file (-checkers-selection-file) to specify the checker selection XML file.

Tips

  • When using an options file, you can activate the guideline checkers and specify a checkers selection file to modify their thresholds. For instance, in an options file, input:

    -guidelines from-file
    -checkers-selection-file selection_xml
    You can also use the preceding options together in the command line.

  • Alternatively, you can specify a checkers activation file by using the command -checkers-activation-file. You do not need to specify the specific options for defects and coding standards. For instance, in the command line or in an options file, input:

    -checkers-activation-file activation_xml 
    where the file activation_xml is a checkers activation file that is created by using the Checkers Selection User Interface. Specifying the option -guidelines is not needed if the Guidelines checkers are activated in the file activation_xml.

  • This options change how Polyspace calculates code metrics:

    These options can change the number of Guidelines violations in your code.

Command-Line Information

Use the command -guidelines in the command line to check for violations of code complexity guidelines.

Parameter: -guidelines
Value: all | his | from-file
Example (Bug Finder): polyspace-bug-finder -sources file_name -guidelines his
Example (Bug Finder Server): polyspace-bug-finder-server -sources file_name -guidelines from-file -checkers-selection-file path_to_xml

Alternatively, enable all or specific code complexity guidelines through a checkers activation XML file. See Checkers activation file (-checkers-activation-file).

Version History

Introduced in R2021a