Configuring code review rules

The code review tool uses a set of predefined rules. You can either disable or set the severity level to Warning or Error.

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 file is located in: <installation directory>/plugins/Common/lib/confrule.xml.
Note: All new projects use the default rule configuration file. When you make any changes to the policy, a new policy file is automatically saved in the project.

Procedure

To 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. Click C/C++ Build > Settings and select Build Settings.
  3. Expand Code review to access the code review settings.
  4. Select the Rule configuration line and click Edit to open the Rule Configuration window.
    1. On the left, select the rule that you want to configure. Rules are grouped into categories. When a rule is selected, its description is displayed on the right.
    2. On the right, select the severity level:
      • Disabled: The selected rule is ignored and is not displayed in the code review report.
      • Warning: When the rule condition is found, a warning is displayed in the code review report.
      • Error: When the rule condition is found, an error is displayed in the code review report.
    3. 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.
  5. Click OK to save the current settings or Save As to save a new rules file to reuse in other projects.
  6. Click OK, Apply the changes and close the Properties window.
Feedback