Ignoring a rule on a portion of code

In some cases, it can be useful to temporarily ignore a rule non-conformance on a short portion of source code, while providing a justification of why you are allowing the non-conformance.

You can justify a non-conformance in the source code, for a specified number of lines and for the first or all occurrences of the error, by adding the following pragma lines to your source code:

You must provide an explanation of why you are ignoring the rule. The justification text is included in the code review report.

To justify a rule discrepancy on a portion of code:

  1. Open the source file in the text editor and locate the lines of code that you want the rule to ignore.

  2. Before the portion of code, add the following line:

#pragma attol crc_justify (<rule>[,<lines>],"<text>")

to justify the first non-conformance encountered, or

#pragma attol crc_justify_all (<rule>,<lines>,"<text>")

to justify all non conformances, where:

Example

The following example causes all non-conformances to the rule M8.5 in the 3 next lines to be ignored and explained in the code review report.

#pragma attol crc_justify_all (Rule M8.5, 3, "Rule M8.5 does not apply to the 3 following lines")

Related Topics

Code review overviewConfiguring code review rules