Fix: Adds exclusion check in IncludeGuardsNotUsed - #1194
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The result-changing behavior needs a change note and dedicated test coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
cpp/common/src/codingstandards/cpp/rules/includeguardsnotused/IncludeGuardsNotUsed.qll — The newly introduced exclusion behavior is not exercised by the existing C or C++ include-guard… |
What changed in this PR
Adds exclusion handling to shared C/C++ include-guard queries.
Changes:
- Suppresses findings for excluded header files.
- Missing required change note and exclusion-specific tests.
- VS Code/OpenPilot validation remains unconfirmed.
| File | Description |
|---|---|
IncludeGuardsNotUsed.qll |
Adds the exclusion check to problems. |
Suppressed comments (1)
cpp/common/src/codingstandards/cpp/rules/includeguardsnotused/IncludeGuardsNotUsed.qll:27
- This new exclusion changes the results of existing shared queries by suppressing alerts. The repository policy in
docs/development_handbook.md:469-475therefore requires a dated change note, but this PR does not add one and marks it as unnecessary. Please add a user-facing change note covering the affected include-guard queries.
not isExcluded(file, getQuery()) and
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…k feedback (#1195) * Add passing/failing tests for IncludeGuardsNotUsed exclusion behavior
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The shared C query path lacks equivalent exclusion regression coverage.
Review tier: Balanced
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
cpp/common/src/codingstandards/cpp/rules/includeguardsnotused/IncludeGuardsNotUsed.qll — The newly introduced exclusion behavior is not exercised by the existing C or C++ include-guard… View resolved comment |
Suppressed comments (1)
cpp/common/src/codingstandards/cpp/rules/includeguardsnotused/IncludeGuardsNotUsed.qll:27
- This shared predicate also powers the C
DIR-4-10query, but only the C++ suite adds an exclusion fixture. The C suite atc/common/test/rules/includeguardsnotusedstill has no excluded header/configuration, so this behavior is not covered for that query. Add the equivalent excluded and non-excluded cases there and update its expected output.
not isExcluded(file, getQuery()) and

Description
Fix the
problemspredicate inIncludeGuardsNotUsed.qllthat did not include an exclusion check (isExcluded).Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.