Implement Preconditions2, appropriate types sent via ellipsis.#1123
Open
MichaelRFairhurst wants to merge 3 commits intomainfrom
Open
Implement Preconditions2, appropriate types sent via ellipsis.#1123MichaelRFairhurst wants to merge 3 commits intomainfrom
MichaelRFairhurst wants to merge 3 commits intomainfrom
Conversation
…conditions-rule-8-2-11-types-passed-by-ellipsis
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the MISRA C++:2023 RULE-8-2-11 query implementation to the “Preconditions2” package, including rule-package metadata and unit tests for detecting class types that should not be passed via an ellipsis (...) parameter.
Changes:
- Added new query
cpp/misra/inappropriate-argument-type-passed-via-ellipsis(RULE-8-2-11) to flag inappropriate class types passed via.... - Added unit tests (
test.cpp),.qlref, and.expectedoutputs for RULE-8-2-11. - Integrated the new Preconditions2 package into the exclusions/metadata plumbing (
RuleMetadata.qll, newPreconditions2.qll, new rule package JSON).
Show a summary per file
| File | Description |
|---|---|
| rule_packages/cpp/Preconditions2.json | Registers RULE-8-2-11 query metadata in the Preconditions2 rule package. |
| cpp/misra/src/rules/RULE-8-2-11/InappropriateArgumentTypePassedViaEllipsis.ql | Implements the new RULE-8-2-11 CodeQL query and alert message. |
| cpp/misra/test/rules/RULE-8-2-11/test.cpp | Adds test cases covering compliant and non-compliant ellipsis arguments. |
| cpp/misra/test/rules/RULE-8-2-11/InappropriateArgumentTypePassedViaEllipsis.qlref | Links the test to the production query file. |
| cpp/misra/test/rules/RULE-8-2-11/InappropriateArgumentTypePassedViaEllipsis.expected | Defines expected results for the unit test run. |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll | Wires Preconditions2 into the global exclusions/metadata registry. |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/Preconditions2.qll | Adds the autogenerated Preconditions2 query metadata module. |
Copilot's findings
Comments suppressed due to low confidence (1)
cpp/misra/test/rules/RULE-8-2-11/test.cpp:43
- This move-assignment operator returns a reference but does not return on all paths. Falling off the end of a non-void function is undefined behavior and may break extraction/compilation depending on warnings-as-errors settings. Please return
*this(or otherwise return a valid reference).
int m1;
NonTrivialMoveAssignClass &operator=(NonTrivialMoveAssignClass &&other) {}
};
- Files reviewed: 7/7 changed files
- Comments generated: 2
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
please enter the description of your change here
Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
RULE-8-2-11Release 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.