- Notifications
You must be signed in to change notification settings - Fork67
Implement package expressions2#906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Implement package expressions2#906
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR introduces the new “Expressions2” package by adding several MISRA-related CodeQL queries, refactoring expression support modules, and updating test headers to mock standard library facilities. Key changes include:
- Addition of five new QLL queries enforcing MISRA rules RULE-8-1-2, RULE-8-1-1, RULE-8-0-1, and RULE-5-13-6.
- Refactoring of
Cpp14Literal
andExpr
modules to support integer suffix parsing and temporary-object flow steps. - Introduction of the
Expressions2Package
and updates to exclusions and rule metadata for the new queries.
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
cpp/misra/src/rules/RULE-8-1-2/ImplicitCapturesDisallowedInNonTransientLambda.ql | New query for explicit captures in non-transient lambdas |
cpp/misra/src/rules/RULE-8-1-1/NonTransientLambdaImplicitlyCapturesThis.ql | New query preventing implicitthis captures |
cpp/misra/src/rules/RULE-8-0-1/MissingSizeofOperatorParenthesis.ql | New query enforcing parentheses aroundsizeof |
cpp/misra/src/rules/RULE-8-0-1/MissingPrecedenceClarifyingParenthesis.ql | New query enforcing clarifying parentheses |
cpp/misra/src/rules/RULE-5-13-6/LongLongLiteralWithSingleLSuffix.ql | New query disallowing singleL suffix onlong long literals |
cpp/common/src/codingstandards/cpp/graph/GraphPathStateSearch.qll | Added stateful graph search module |
cpp/common/src/codingstandards/cpp/Expr.qll | Refactored expression module; extractedtemporaryObjectFlowStep |
cpp/common/src/codingstandards/cpp/Cpp14Literal.qll | AddedIntegerLiteralSuffix class andgetSuffix() |
cpp/common/src/codingstandards/cpp/Scope.qll | AddedfunctionDefinedInTranslationUnit predicate |
cpp/common/src/codingstandards/cpp/exclusions/cpp/Expressions2.qll | New autogenerated exclusions for Expressions2 |
cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll | ImportedExpressions2 in rule metadata |
cpp/common/test/includes/standard-library/utility.h | Provided definitions forforward overloads |
cpp/common/test/includes/standard-library/functional.h | Updatedstd::function mock constructor |
Comments suppressed due to low confidence (1)
cpp/common/test/includes/standard-library/utility.h:11
- The
move
function is declared but not defined. Consider providing a definition like:
template<classT>constexprremove_reference_t<T>&& move(T&& t)noexcept {returnstatic_cast<remove_reference_t<T>&&>(t);}
template <class T> constexpr remove_reference_t<T> &&move(T &&t) noexcept;
* instance, we could use this graph to find recursive functions, which requires knowing how an end | ||
* node was reached from a start node (the state). | ||
* | ||
* Like `GraphPathSearch`, this module uses forward-reverse pruning, wihch is a pattern that is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Typo in comment: 'wihch' should be 'which'.
* Like `GraphPathSearch`,thismodule uses forward-reverse pruning,wihch is a pattern that is | |
* Like `GraphPathSearch`,thismodule uses forward-reverse pruning,which is a pattern that is |
Copilot uses AI. Check for mistakes.
pragma[inline_late] | ||
predicate functionDefinedInTranslationUnit(Function f, TranslationUnit tu) { | ||
exists(FunctionDeclarationEntry fde | fde = f.getDefinition() | | ||
fde = f.getDefinition() and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Duplicate predicate 'fde = f.getDefinition()' is redundant. Consider removing one of the identical checks to simplify the clause.
fde = f.getDefinition() and |
Copilot uses AI. Check for mistakes.
Uh oh!
There was an error while loading.Please reload this page.
Description
please enter the description of your change here
Change request type
.ql
,.qll
,.qls
or unit tests)Rules with added or modified queries
RULE-8-0-1
RULE-8-1-1
RULE-8-1-2
RULE-5-13-6
RULE-18-9
(no visible changes expected)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 ofshared 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.