Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds CodeQL support for MISRA C++:2023 RULE-13-3-3 by introducing a new query package (Declarations1), integrating it into the exclusions/metadata system, and adding unit tests.
Changes:
- Register RULE-13-3-3 in
rules.csvto point at the newDeclarations1package. - Add the new production query
DeclarationsOfAFunctionSameParameterName.qlplus package metadata/exclusions wiring. - Add a new test directory with
.qlref+.expectedand test sources.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| rules.csv | Routes RULE-13-3-3 to the new Declarations1 package. |
| rule_packages/cpp/Declarations1.json | Adds rule-package metadata for RULE-13-3-3. |
| cpp/misra/src/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.ql | Implements the RULE-13-3-3 query logic and message. |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/Declarations1.qll | Adds autogenerated exclusions/metadata wrapper for the new package. |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll | Integrates Declarations1 into the global query metadata plumbing. |
| cpp/misra/test/rules/RULE-13-3-3/functions1.cpp | Adds test cases (currently has annotation/intent mismatches). |
| cpp/misra/test/rules/RULE-13-3-3/functions2.cpp | Adds test cases (currently has annotation/intent mismatches). |
| cpp/misra/test/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.qlref | Hooks the test to the production query. |
| cpp/misra/test/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.expected | Expected results for the query (currently inconsistent with some test annotations). |
Comments suppressed due to low confidence (1)
cpp/misra/test/rules/RULE-13-3-3/functions1.cpp:14
- This is marked
NON_COMPLIANT, but the corresponding declaration(s) use the same parameter names (w,h). The.expectedfile also has no result forf6, so the test annotations and expectations are inconsistent. Either change this toCOMPLIANT, or adjust the declarations to actually create a parameter-name mismatch and update.expectedaccordingly.
a f6(wi w, wi h) { // NON_COMPLIANT
return (a)w * h;
}
You can also share your feedback on Copilot code review. Take the survey.
cpp/misra/src/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.ql
Outdated
Show resolved
Hide resolved
cpp/misra/src/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.ql
Outdated
Show resolved
Hide resolved
cpp/misra/src/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.ql
Show resolved
Hide resolved
| @@ -0,0 +1,36 @@ | |||
| void f1(int a); // COMPLIANT -- same name | |||
| void f2(int a); // COMPLIANT -- unnamed is fine | |||
MichaelRFairhurst
requested changes
Mar 19, 2026
Collaborator
MichaelRFairhurst
left a comment
There was a problem hiding this comment.
Just one missing finding, otherwise looks good!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
add RULE-13-3-3, overlaps with/similar to implementation from RULE-8-3
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.