Configure Coding Rule Checks and Code Metrics
You can check for violation of coding standards and calculate coding metrics using Polyspace® Bug Finder™.
To check for coding rule violations, activate a set of coding rules and defects by
using the Checkers Selection window. Save the activated
set of checkers in a checkers activation file (.xml) and then use
the activation file in your subsequent analyses. See Checkers
activation file (-checkers-activation-file).
Alternatively, you can activate preselected sets of rules from a specific coding
standard. For instance, activate the mandatory rules from MISRA C™:2023 by using the option Check MISRA
C:2023 (-misra-c-2023) with the value
mandatory.
You can also calculate function-level, file-level, and project-level code metrics
by specifying the option Calculate code metrics
(-code-metrics). This option calculates a set of code metrics such
as cyclomatic complexity, comment density, or number of recursions in your
project.
Polyspace Options
System Commands
polyspace-catalog-bundler | (System Command) Create user-defined Polyspace coding standards at the DOS or UNIX command line |
Topics
Configure Checkers
- Specify Polyspace Analysis Options
Specify Polyspace analysis options in Polyspace user interface, other IDE-s or scripts. - Check for and Review Coding Standard Violations
Check for violations of AUTOSAR C++14, CERT C, CERT C++, CWE, MISRA C, MISRA C++, JSF AV C++, or ISO-17961 standards with Polyspace Bug Finder. - Prepare Checkers Configuration for Polyspace Bug Finder Analysis
Deploy common checkers configuration to enforce uniform standards, mix defect and coding rule checkers. - Create New Checkers Activation File Without Polyspace User Interface
When Polyspace user interface is unavailable, configure checkers by creating a checkers activation file in a text editor.
MISRA Rules
- Avoid Violations of MISRA C Rules 8.x
Avoid conflicting declarations or unintended modification of variables. - Coding Rule Subsets Checked Early in Analysis
Adjust your coding rules checking for a faster analysis.
CWE
- Polyspace Support of CWE Categories
Group CWE results by category. - Mapping Between CWE-658 or CWE-659 and Polyspace Bug Finder Defect Checkers
See how Polyspace defect checkers are related to the subset of CWE™ standards, CWE-658 and CWE-659.
User-Defined Coding Standards
- Create User-Defined Coding Standard by Using Polyspace Query Language
Create new user defined defects and use these defects along with existing bug Finder checkers to create a user-defined coding standard in a sharable
.pschkfile. - Create User-Defined Coding Standard by Using Polyspace Bug Finder Checkers
Map Bug Finder checkers to coding rules in a user-defined coding standard in a sharable.pschkfile.
Code Complexity Metrics
- Compute Code Complexity Metrics Using Polyspace
Enforce limits on code complexity metrics such as cyclomatic complexity and depth of nesting. - HIS Code Complexity Metrics
See which code complexity metrics supported in Polyspace are part of the Hersteller Initiative Software (HIS) standard.
Polyspace Guidelines
- Reduce Software Complexity by Using Polyspace Checkers
Enable and configure the software complexity checkers to identify issues that make your code difficult to read, understand, and debug.
Polyspace Custom Rules
- Enforce Naming Conventions for C/C++ Variables and Functions
Enforce naming conventions and other style guidelines on C/C++ code with Polyspace.