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 HCL OneTest Embedded 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

By default all rules are enabled and produce either an error or a warning in the code review report. You can save multiple customized rule policies. The default rule policy files MISRA 2004 and MISRA 2012 are located in: <installation directory>/plugins/Common/lib/confrule.xml. Do not modify the default rule configuration files. The only change that can be done in the default rule configuration files is to change or disable the severity level of the rule.
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:
  1. In the project explorer, right-click the project on which you want to change the settings and click Properties.
  2. Expand C/C++ Build in the left panel, select Settings.
  3. In the right panel, in the Build tab, expand Settings and select Code Review.
  4. Expand Code review to access the code review settings. Code review Settings
  5. 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.
  6. 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.
  7. Click OK.
    The path to the selected rule configuration is displayed in the value column on the Rule Configuration line.
  8. On the Rule configuration row, click the configuration file to open the Rule Configuration window. Rule configuration window
  9. 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.
  10. On the right panel, select the severity level:
    1. Disabled: The selected rule is ignored and is not displayed in the code review report.
    2. Warning: When the rule condition is found, a warning is displayed in the code review report.
    3. Error: When the rule condition is found, an error is displayed in the code review report.
      Note: Multiple user-custom rules (from Rule U99.1 to Rule U99.10) can be defined for MISRA 2004 and MISRA 2012 with their own severity level.
  11. 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:
  1. In the Project Explorer, right-click the project on which you want to change the settings and click Properties.
  2. Click C/C++ Build > Settings and select Build Settings.
  3. In the right panel, click SettingsGeneral > Multi-Thread option.
  4. Click ... in the value field of the Entry points option to open the editor.
  5. In the editor, enter the list of entry points for each thread and click OK.
  6. 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).