Configuring code review rules
The code review tool uses a set of predefined rules. You can select the default rule configuration file for the code review tool. MISRA 2004 and MISRA 2012 from Rational® Test RealTime V8.2.0 are the default installed rule configuration files. You can disable or set the severity level to Warning. You can also configure the entry-point option if your application is multi-threaded.
About this task
Note: For all new projects, you must select
the configuration file that must be used. When you make any changes to the rule policy file, you
can save the new policy file in the project.
Procedure
To select the configuration file and disable or set the severity level of code
review rules:
- In the project explorer, right-click the project on which you want to change the settings and click Properties.
- Expand C/C++ Build in the left panel, select Settings.
- In the right panel, in the Build tab, expand Settings and select Code Review.
- Expand Code review to access the code review settings.
-
Click in the value on the Rule configuration row and click
... to select a rule configuration file.
Note: If your configuration file is an out-of-date version, you are prompted to update it. Click ok to select the rules that are missing in your configuration file. The selected rules are added with their default severity levels to your configuration file. Unselected rules are added to your configuration file as disabled rules.
- Select the default MISRA 2004 or MISRA 2012 rule configuration file that are installed with the product. Alternatively, click + to select a new rule configuration in your browser.
-
Click OK.
The path to the selected rule configuration is displayed in the value column on the Rule Configuration line.
- On the Rule configuration row, click the to open the Rule Configuration window.
-
In the Rule configuration window, select the rule that you want to
configure.
Rules are grouped into categories. You can filter the rules by labels from the Find field. Search is not case sensitive.When a rule is selected, its description is displayed on the right panel with the parameter description and value if any parameter is available for the selected rule.
-
On the right panel, select the severity level:
-
Select Show only the first occurrence to only show the first
occurrence of a rule condition in a file. Any subsequent occurrences of the condition are not
reported.
Note: If your application is multi-threaded, you can provide the list of entry points to avoid that the rules about 'non-used functions' are raised.
To configure the Multi_thread option, follow these steps:
- In the Project Explorer, right-click the project on which you want to change the settings and click Properties.
- Click Build Settings. and select
- In the right panel, click General > Multi-Thread option.
- Click ... in the value field of the Entry points option to open the editor.
- In the editor, enter the list of entry points for each thread and click OK.
-
Click OK, Apply the changes and close the
Properties window.
Note: The Entry point option applies to rule E16.50 (MISRA_2004) and M2.2.2 (MISRA 2012).