Main Content

Set checkers by file (-checkers-selection-file)

(Removed) Define a custom set of coding standards checks for your analysis

This option applies only to coding rules and code metrics, which has been removed from Code Prover. Use Set checkers by file (-checkers-selection-file) in Bug Finder instead. For more information, see Version History.

Description

Specify the full path of a configuration XML file where you define custom selections of coding standards checkers. In the same XML file, you can specify a custom selection of checkers for each of these coding standards:

  • MISRA C™:2004

  • MISRA C:2012

  • MISRA™ C++

  • JSF AV C++

  • AUTOSAR C++14 (Bug Finder only)

  • CERT® C (Bug Finder only)

  • CERT C++ (Bug Finder only)

  • ISO®/IEC TS 17961 (Bug Finder only)

  • Polyspace® Guidelines (Bug Finder only)

You can also define custom rules to match identifiers in your code to text patterns you specify.

Set Option

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

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

When you enable this option, set the coding standards that you select to from-file to use the specified configuration file.

Why Use This Option

Use this option to define a selection of coding standard checkers specific to your organization. The configuration of different coding standards is consolidated in a single XML file that you can reuse across projects to enforce common coding standards.

Settings

On

Polyspace checks your code against the selection of coding standard checkers, or the custom rules, defined in the configuration file that you specify.

To create a configuration file by using the Polyspace Desktop, in the Configuration, select Coding Standards & Code Metrics. To open the Checkers selection interface, click the folder () on the right pane. Choose the coding standards that you want to configure in the left pane, and then select the rules that you want to activate in the right pane.

To create a configuration file by using Polyspace As you Code IDE plugins, refer to the documentation of your specific plugin.

To use or update an existing file, enter the full path to the file in the Select file field of the Checkers selection dialog box. Alternatively, click Browse in the Checkers selection window and browse to the existing file.

Off (default)

Polyspace does not check your code against the selection of coding standard checkers, or the custom rules, defined in the configuration file you specify.

Tips

  • For the Polyspace desktop products, specify the coding standard configuration in the Polyspace User Interface. When you save the configuration, an XML file is created for use in the current and other projects.

  • For the Polyspace Server products, you have to create a coding standard XML. Depending on the standard that you want to enable, make a writeable copy of one of the files in polyspaceserverroot\polyspace\examples\doc_cxx\coding_standards_XML. Turn off rules by using entries in the XML file (all rules from a standard are enabled in the template). Here, polyspaceserverroot is the root installation folder for the Polyspace Server products, for instance, C:\Program Files\Polyspace Server\R2019a.

    For instance, to turn off MISRA C:2012 rule 8.1, in the file misra_c_2012_rules.xml, use this entry:

    <standard name="MISRA C:2012">
      ...
      <section name="8 Declarations and definitions">
          ...
          <check id="8.1" state="off">
          </check>
          ...
      </section>
      ...
    </standard>

    For a full list of rule IDs and section names, see:

    Note

    The XML format of the checker configuration file might change in future releases.

Command-Line Information

Parameter: -checkers-selection-file
Value: Full path of XML configuration file
Default: Off
Example (Bug Finder): polyspace-bug-finder -sources file_name -checkers-selection-file "C:\Standards\custom_config.xml" -misra3 from-file
Example (Code Prover): polyspace-code-prover -sources file_name -checkers-selection-file "C:\Standards\custom_config.xml" -misra3 from-file
Example (Bug Finder Server): polyspace-bug-finder-server -sources file_name -checkers-selection-file "C:\Standards\custom_config.xml" -misra3 from-file
Example (Code Prover Server): polyspace-code-prover-server -sources file_name -checkers-selection-file "C:\Standards\custom_config.xml" -misra3 from-file

Version History

expand all

R2024a: Removed from Code Prover

If you use the option -checkers-selection-file in a Code Prover analysis, Polyspace issues a warning and the analysis ignores the option. The workflow for checking coding rule violation has been removed from Code Prover. To check for coding rule violations, use Bug Finder. For instance, at the command line, replace this command:

polyspace-code-prover -sources file -checkers-selection-file XML -misra3 from-file
with this command:
polyspace-bug-finder -sources file -checkers-selection-file XML -misra3 from-file
See Migrate Code Prover Workflows for Checking Coding Standards and Code Metrics to Bug Finder.