You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user_manual.md
+21-18Lines changed: 21 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -426,10 +426,13 @@ The `process_coding_standards_config.py` has a dependency on the package `pyyaml
426
426
A code identifier specified in a deviation record can be applied to certain results in the code by adding a C or C++ attribute of the following format:
For example `[[codeql::misra_deviation("a1-2-4")]]` would apply a deviation of a rule in a MISRA standard, using the code identifier `a1-2-4`. The supported standard names are `misra`, `autosar` and `cert`.
433
+
432
434
This attribute may be added to the following program elements:
435
+
433
436
* Functions
434
437
* Statements
435
438
* Variables
@@ -440,7 +443,7 @@ Deviation attributes are inherited from parents in the code structure. For examp
440
443
Multiple code identifiers may be passed in a single attribute to apply multiple deviations, for example:
Note - considation should be taken to ensure the use of custom attributes for deviations is compatible with your chosen language version, compiler, compiler configuration and coding standard.
@@ -461,10 +464,10 @@ If you cannot satisfy these condition, please use the deviation code identifier
461
464
As an alternative to attributes, a code identifier specified in a deviation record can be applied to certain results in the code by adding a comment marker consisting of a `code-identifier` with some optional annotations. The supported marker annotation formats are:
462
465
463
466
- `<code-identifier>`- the deviation applies to results on the current line.
464
-
- `codingstandards::deviation(<code-identifier>)`- the deviation applies to results on the current line.
465
-
- `codingstandards::deviation_next_line(<code-identifier>)`- this deviation applies to results on the next line.
466
-
- `codingstandards::deviation_begin(<code-identifier>)`- marks the beginning of a range of lines where the deviation applies.
467
-
- `codingstandards::deviation_end(<code-identifier>)`- marks the end of a range of lines where the deviation applies.
467
+
- `codeql::<standard>_deviation(<code-identifier>)`- the deviation applies to results on the current line.
468
+
- `codeql::<standard>_deviation_next_line(<code-identifier>)`- this deviation applies to results on the next line.
469
+
- `codeql::<standard>_deviation_begin(<code-identifier>)`- marks the beginning of a range of lines where the deviation applies.
470
+
- `codeql::<standard>_deviation_end(<code-identifier>)`- marks the end of a range of lines where the deviation applies.
468
471
469
472
Here are some examples, using the deviation record with the `a-0-4-2-deviation` code-identifier specified above:
470
473
```cpp
@@ -473,32 +476,32 @@ Here are some examples, using the deviation record with the `a-0-4-2-deviation`
473
476
long double x2; // a-0-4-2-deviation - COMPLIANT
474
477
long double x3; // COMPLIANT - a-0-4-2-deviation
475
478
476
-
long double x4; // [[codingstandards::deviation(a-0-4-2-deviation)]] - COMPLIANT
477
-
long double x5; // COMPLIANT - [[codingstandards::deviation(a-0-4-2-deviation)]]
479
+
long double x4; // codeql::<standard>_deviation(a-0-4-2-deviation) - COMPLIANT
480
+
long double x5; // COMPLIANT - codeql::<standard>_deviation(a-0-4-2-deviation)
`codingstandards::deviation_end` markers will pair with the closest unmatched `codingstandards::deviation_begin` for the same `code-identifier`. Consider this example:
490
+
`codeql::<standard>_deviation_end` markers will pair with the closest unmatched `codeql::<standard>_deviation_begin` for the same `code-identifier`. Consider this example:
Here, Line 1 will pair with Line 7, and Line 3 will pair with Line 8.
498
501
499
-
A `codingstandards::deviation_end` without a matching `codingstandards::deviation_begin`, or `codingstandards::deviation_begin` without a matching `codingstandards::deviation_end` is invalid and will be ignored.
502
+
A `codeql::<standard>_deviation_end` without a matching `codeql::<standard>_deviation_begin`, or `codeql::<standard>_deviation_begin` without a matching `codeql::<standard>_deviation_end` is invalid and will be ignored.
500
503
501
-
`codingstandards::deviation_begin`and `codingstandards::deviation_end` markers only apply within a single file. Markers cannot be paired across files, and deviations do not apply to included files.
504
+
`codeql::<standard>_deviation_begin`and `ccodeql::<standard>_deviation_end` markers only apply within a single file. Markers cannot be paired across files, and deviations do not apply to included files.
502
505
503
506
Note: deviation markers cannot be applied to the body of a macro. Please apply the deviation to macro expansion, or use the attribute deviation format.
0 commit comments