Skip to content

Commit 60b3115

Browse files
Apply wording suggestion from code review
Co-authored-by: Robert C. Seacord <rcseacord@gmail.com>
1 parent a85c6ff commit 60b3115

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Diff for: docs/design/guideline_recategorization.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The document [MISRA Compliance:2020](https://www.misra.org.uk/app/uploads/2021/0
3030
- Required guidelines - guidelines which can only be violated when supported by a deviation.
3131
- Advisory guidelines - recommendations for which violations are identified but are not required to be supported by a deviation.
3232

33-
Guideline recategorization is possible by means of a Guideline Recategorization Plan (GRP). A GRP is a contract between the acquirer and supplier to determine how guidelines are applied.
33+
Guideline recategorization is possible by means of a guideline recategorization plan (GRP). A GRP is a contract between the acquirer and supplier to determine how guidelines are applied.
3434
The GRP defines the additional category Disapplied to be used for Advisory guidelines which are to be ignored. Any other category can be recategorized into stricter categories to ensure that a guideline adheres to the associated policy.
3535
The following table summarizes the possible recategorizations.
3636

@@ -40,11 +40,11 @@ The following table summarizes the possible recategorizations.
4040
| Required | Mandatory |
4141
| Advisory | Disapplied, Required, Mandatory |
4242

43-
Other recategorizations, from here on denoted as invalid recategorizations, are not applied and are to be reported to the user.
43+
Other recategorizations are invalid, not applied, and reported to the user.
4444

4545
## Design
4646

47-
Our design includes a Guideline Recategorization Plan specification, logic to apply the category policy to associated guidelines, and a SARIF result rewriter to reflect the new category in the results.
47+
CodeQL Coding Standards includes a GRP, logic to apply the category policy to associated guidelines, and a SARIF result rewriter to reflect the new category in the results.
4848
The application of a policy will modify the behavior of a CodeQL queries implementing guidelines as follows:
4949

5050
| Category | Effect |
@@ -54,14 +54,14 @@ The application of a policy will modify the behavior of a CodeQL queries impleme
5454
| Advisory | Violations are reported unless there exists an applicable deviation. |
5555
| Disapplied | Violations are not reported. |
5656

57-
The SARIF rewriting will update the category of a guideline in a SARIF result file by updating the necessary tag information of a query.
57+
The SARIF rewrite updates the guideline category in a SARIF result file by updating the query's tag information.
5858

59-
### Guideline Recategorization Plan specification
59+
### Guideline Recategorization Plan
6060

61-
The Guideline Recategorization Plan specification will build upon the configuration specification introduced for deviations by adding the additional primary section `guideline-recategorizations` to the `codeql-standards.yml` configuration file.
61+
The GRE builds upon the configuration specification introduced for deviations by adding the additional primary section `guideline-recategorizations` to the `codeql-standards.yml` configuration file.
6262
The `guideline-recategorizations` section will be a series of compact mappings in YAML with the keys:
6363

64-
- `rule-id` - the rule identifier that is recategorized.
64+
- `rule-id` - the recategorized rule identifier.
6565
- `category` - the category assigned to the rule identified by rule-id
6666

6767
Note: We specify the recategorization based on the rule-id instead of the query-id. This can be revised if feedback requires more fine-grained recategorization.
@@ -80,9 +80,9 @@ This section discusses the implementation of the [design](#design).
8080
8181
### Specification and deviation
8282
83-
The implementation will rely on the existing rule meta-data and query exclusion mechanisms to apply policies associated with a rule’s category.
83+
The implementation relies on the existing rule meta-data and query exclusion mechanisms to apply policies associated with a rule’s category.
8484
The rule meta-data already includes both the `query-id` and `rule-id` associated with a query and is available during query evaluation.
85-
The rule meta-data needs to be extended with a category that contains the guideline’s category.
85+
The rule meta-data must be extended with a category that contains the guideline’s category.
8686

8787
For example:
8888

@@ -97,17 +97,17 @@ For example:
9797
category = “required”
9898
```
9999

100-
The category defined by the rule meta-data and the category defined in the `guideline-recategorizations` of the applicable `codeql-standards.yml` configuration file is used to determine the *effective category* of a query.
100+
The category defined by the rule meta-data and the category defined in the `guideline-recategorizations` of the applicable `codeql-standards.yml` configuration file specifies the *effective category* of a query.
101101
The *effective category* is the category whose policy is applied during the evaluation of a query.
102102
The policy of a category dictates if a result can be deviated from and implements the effect described in the design section.
103103
The existing exclusion mechanism implemented in the predicate `isExcluded` defined in the `Exclusions.qll` library will be updated to consider the applicable policy of a guideline.
104104

105-
Note: This will change the behavior of deviations which will no longer have an impact on Mandatory guidelines! This, however, will only impact MISRA C rules because there are no MISRA C++ Guidelines with a Mandatory category.
105+
Note: This changes the behavior of deviations which will no longer have an impact on Mandatory guidelines! However, this will only affect MISRA C rules because there are no MISRA C++ Guidelines with a Mandatory category.
106106

107107
### Specification validation
108108

109-
To assist users with correctly specifying a Guideline Recategorization Plan (GRP) specification we can implement two validations mechanisms that validate the specification at two different points in a GRP life cycle.
110-
The first validation mechanism will perform syntax validation of the specification provided in the guideline-recategorizations section of a `codeql-standards.yml` configuration file and can provide feedback in any editor that supports JSON schemas published at the [JSON schema store](https://www.schemastore.org/json/).
109+
To assist users with correctly specifying a GRP specification we can implement two validations mechanisms that validate the specification at two different points in a GRP life cycle.
110+
The first validation mechanism performs syntax validation of the specification provided in the guideline-recategorizations section of a `codeql-standards.yml` configuration file and can provide feedback in any editor that supports JSON schemas published at the [JSON schema store](https://www.schemastore.org/json/).
111111
A schema for `codeql-standards.yml` can be extended with the definition of `guideline-category` and the property `guideline-recategorizations`:
112112

113113
```json
@@ -151,9 +151,9 @@ A schema for `codeql-standards.yml` can be extended with the definition of `guid
151151

152152
The second validation mechanism is the generation of a `guideline-recategorization-plan-report.md` containing alerts on semantically incorrect recategorizations.
153153
That is, possible recategorizations that are not described as valid in the introduction.
154-
Semantically invalid recategorizations will be detected by looking at a query’s categorization and its effective categorization (i.e., its applied recategorization).
154+
Semantically invalid recategorizations are detected by examining a query’s categorization and its effective categorization (i.e., its applied recategorization).
155155

156-
In addition, an update to the `deviations_report.md` report’s invalidate deviations table will provide feedback to users that apply deviations to guidelines with an effective category equal to `mandatory` which cannot be deviated from.
156+
In addition, an update to the `deviations_report.md` report’s invalidate deviations table provides feedback to users that apply deviations to guidelines with an effective category equal to `mandatory` which cannot be deviated from.
157157
The changes to generate the new report and update the existing report will be made in the report generation script `scripts/reports/analysis_report.py`.
158158

159159
### SARIF rewriting

0 commit comments

Comments
 (0)