| Contents | Index |
| On this page… |
|---|
Running a Verification with Coding Rules Checking |
When you run a verification with the MISRA C, Check MISRA C++ rules or Check JSF C++ rules option selected, the verification checks most of the rules during the compile phase. If there is a violation of a rule with state Error, the verification stops.
To start the verification:
On the Project
Manager toolbar, click
the Run button
.
Code analysis begins.
If the coding rules checker detects violations of coding rules set to Error, the verification stops, and the Output Summary tab shows that the verification has detected coding rules violations.

If there are no violations of rules set to Error, code verification continues after the completion of rules checking.
When rules checking is complete, the file MISRA-C-report.xml, MISRA-CPP-report.xml, or JSF-report.xml appears in the Project Browser Result folder. This file contains the results from the coding rules checker.
Note If any source files in the verification do not compile, coding rules checking will be incomplete. The coding rules checker results may not contain full results for files that did not compile, and may not contain full results for the files that did compile since some rules are checked only after compilation is complete. |
When code analysis is complete, you can view results in the Results Manager perspective.
To examine coding rule violations:
Double-click MISRA-C-report.xml, MISRA-CPP-report.xml or JSF-report.xml in the Project Browser Result folder.
The Results Manager perspective opens, displaying results on the Results Explorer tab.

The software displays coding rule violations as purple checks.
To display a list of checks by color, select the Results Summary tab. By default, the software displays the purple checks at the end of the list.
Note If you set the review level to 0, the Results Summary tab displays only violations of coding rules with state Error. See What Are Review Levels? |

Click any purple check. In the Check Details pane, you see the location and description of the violated rule. In the Source pane, you see the code containing the violation.

If required, use the Check Review tab to classify, apply comments, or justify the coding rule violation. See Commenting and Justifying Coding Rule Violations .
To open the source file that contains the coding rule violation, in the Source pane, right-click the code with the purple check. From the context menu, select Open Source File. The appropriate file opens in your text editor.
Note Before you can open source files, you must configure a text editor. See Configuring Text and XML Editors. |
Correct the coding rule violation.
When you have corrected all coding rule violations, run the verification again.
When reviewing coding rules violations in the Results Manager perspective, you can classify the severity of each violation, mark violations as Justified, and enter comments to describe the results of your review.
After you mark violations as Justified, you can hide them. This helps you track the progress of your review and avoid reviewing the same violation twice.
To review, comment, and justify a violation:
In the Results Manager perspective, from the Results Explorer or Results Summary tab, select the violation you want to review. In the Check Details pane, you see the location and description of the violated rule. In the Source pane, you see the code containing the violation.
Review the violation. Then, on the Check Review tab, select a Classification to describe the severity of the issue:
High
Medium
Low
Not a defect
Select a Status to describe how you intend to address the issue:
Fix
Improve
Investigate
Justify with annotations
No Action Planned
Other
Restart with different options
Undecided
Note You can also define your own statuses. See Defining Custom Status . |
In the comment box, enter additional information about the violation.
Select the Justified check box to indicate that you have justified this check.
You can use the Polyspace Report Generator to generate reports about compliance with coding rules, as well as other reports. For information on using the Polyspace Report Generator, see Generating Reports of Verification Results.
The coding rules report contains all the errors and warnings reported by the coding rules checker. You see the following information in tables:
Summary of violations by file — Number of errors and warning in each file
Summary of rules broken — Rule number, rule description, severity, and total number of rule violations
Warnings generated from each file — Rule number, warning message, function name, location of code (line and column number), review information (justification, classification, status, and comment)
Errors generated from each file — Rule number, warning message, function name, location of code (line and column number), review information (justification, classification, status, and comment)
Configuration settings — Verification options
Coding rules configuration — Whether violation of a rule is set to be an error or a warning
.
Note You must configure an editor before you can open a MISRA-C report. See Configuring Text and XML Editors. |
To view the coding rules report:
Navigate to the folder that contains your coding rules report, for example, C:\Polyspace\example_project\Module_1\Result_6\Polyspace-Doc.
![]()
Double-click the coding rules report, for example, example_project_CodingRules.rtf. The report opens in your selected editor.
Note If any source files in the verification do not compile, the verification fails with compilation errors, and coding rules checking is incomplete. If this happens, the coding rules report is not exhaustive. The report may not contain full results for files that did not compile, and may not contain full results for the files that did compile since some rules are checked after compilation. |
Instead of typing the full syntax of an annotation comment in your source code, you can copy an annotation template from the Results Manager perspective, paste it into your source code, and modify the template to comment the check.
To copy the justification template to the clipboard:
In the Results Manager perspective, from the Results Summary tab, select any coding rule violation.
From the Source pane, right-click the violation.
From the context menu, select Add Pre-Justification to Clipboard. The software copies the justification string to the clipboard.
Open the source file containing the violation you want to justify.
Navigate to the code you want to comment, and paste the justification template string on the line immediately before the line you want to comment.
Modify the template text to comment the code appropriately.

Save the file.
![]() | Setting Up Coding Rules Checking | Software Quality Objective Subsets of Coding Rules (C) | ![]() |
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |