Set checkers by file
(-checkers-selection-file
)
Define a custom set of coding standards checks for your analysis
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
CERT C++
ISO®/IEC TS 17961
Polyspace® Guidelines
You can also define custom rules to match identifiers in your code to text patterns you specify.
If you use a selection XML file generated by using a previous version of Polyspace, previously unimplemented checkers might become implemented. Polyspace warns if the file XML file lists an implemented checker as
'notimplemented'
.
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 Instead, the option is split
into the options Use custom
checkers file
and Checkers
activation file (-checkers-activation-file)
.
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.
To create a custom coding standard classification, or to tag coding rule checkers of interest, enter text in the Comment column of the Checkers selection window. Polyspace displays that text in the Results Details pane and in the Detail column of the Results List (if available) when you review results in the desktop interface, in Polyspace Access™, or in the Polyspace as You Code plugins.
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
. Enable specific rules by using entries in the XML file (all rules from a standard are disabled in the template). Here,polyspaceserverroot
\polyspace\examples\doc_cxx\coding_standards_XML
is the root installation folder for the Polyspace Server products, for instance,polyspaceserverroot
C:\Program Files\Polyspace Server\R2024b
.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
Use the command -checkers-selection-file
in the command line to
select a custom set of coding standards checks for your analysis.
Parameter:
-checkers-selection-file |
Value: Full path of XML configuration file |
Default: Off |
Example (Bug Finder):
polyspace-bug-finder -sources |
Example (Bug Finder
Server):
polyspace-bug-finder-server -sources |
Alternatively, activate the custom selection of coding rules and Bug Finder defects
in an activation XML file. See Checkers activation file
(-checkers-activation-file)
.