Code review deviations

In some cases, it can be useful to temporarily ignore a rule non-compliance on a short portion of source code, while documenting the reason why you are allowing this deviation.

About this task

You can justify why you are allowing the deviation in a text. The text is added to the non-compliance in the source code. You can declare a deviation in the source code, for a specified number of lines and for the first or all occurrences of the error, by adding pragma lines to your source code.

Procedure

  1. Open the source file in the Text editor and find the lines of code that you want the rule to ignore.
  2. Before the section of code for which compliance to the rule should be ignored, add one of the following lines:
    • To justify non-compliance of a rule to the following pragma statement in the first occurrence:
      #pragma attol crc_justify (<rule>[,<lines>],"<text>")
    • To justify non-compliance of a rule to the following pragma statement in all occurrences:
      #pragma attol crc_justify_all (<rule>,<lines>,"<text>")
    • To justify the first occurrence of non-compliance of a rule in all the files of the current project, including in traps located before the pragma statement:
      #pragma attol crc_justify_everywhere (<rule>,"<text>")
    For all the pragma statements: <rule>
    • <rule> is the name of the code review rule (for example: 'Rule M8.5').
    • <lines> is the number of lines.
    • <text> is the reason why the rule is ignored.

    The recommended usage for crc_justify_everywhere is to create a specific source file containing only the list of pragma statements and add this file to the project.

Feedback