- Notifications
You must be signed in to change notification settings - Fork70
Add support for deviations on next line and multiple lines#807
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lgtm-style suppressions are no longer supported by CodeQL andCode Scanning.
This new library supports deviating on the next line, or on ranges,in addition to deviating on the current line.
This ties in the code-identifier deviation support to the deviationsand exclusions libraries.
This commit adds support for C/C++ attributes to specify deviationswith code identifiers in the code.Attributes are inherited from parents, and support multiple codeidentifiers in a single definition.
Attributes are inherited from their parent.Includes support for features which are not currently enabled,due to lack of support in CodeQL itself.
MichaelRFairhurst left a comment
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.
Fun PR to read through, very cool to see the stack as a solution for implementing pairings in an immutable context like CodeQL! Some thoughts on it since its a cool weedy coding task!
cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
cpp/common/src/codingstandards/cpp/deviations/InvalidDeviationCodeIdentifier.qlShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cpp/common/src/codingstandards/cpp/deviations/InvalidDeviationCodeIdentifier.md OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
MichaelRFairhurst left a comment
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.
Thanks, LGTM! Just one question left.
cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
cpp/common/src/codingstandards/cpp/deviations/CodeIdentifierDeviation.qll OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Deviation code identifier markers can have multiple records.
lcartey commentedFeb 18, 2025
/test-performance |
🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute. |
🏁 Beep Boop! Performance testing complete! See below for performance of the last 3 runs vs your PR. Times are based on predicate performance. You canfind full graphs and stats in the PR that was created for this test in the release engineering repo. 🏁 Below are the slowest predicates for the last 2 releases vs this PR. |
fjatWbyT commentedMar 11, 2025
While going through the first table, I think that The salient result I noticed in 807 is in the second table:
|
MichaelRFairhurst left a comment
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.
LGTM!
MichaelRFairhurst commentedMar 12, 2025
@fjatWbyT yes, good catch. That was introduced past the last release (by me!) and was fixed. Overall, esp. with that fixed, everything here looks great to me. |
afbfbecUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Description
This PR proposes an extension of our deviations mechanism to support easier suppression of results at scale - including applying deviations to a block of code, to code on the next line and to code in macros.
We introduce a C/C++ attribute format -
[[codeql::<standard>_deviation(<code-identifier>)]]- which applies the deviation distinguished by the<code-identifier>to the program element, and those nested within it. This attribute can be applied to:For example,
[[codeql::autosar_deviation("a0-4-2")]]would apply the deviation specified using the code identifiera0-4-2, related to theautosarCoding Standard.Custom attributes are not universally supported - for example, they were only introduced in C23 - so we also provide an attribute-like syntax to be used in comment markers:
codeql::<standard>_deviation(<code-identifier>)- the deviation applies to results on the current line (duplication of existing non-annotated support, included for consistency).codeql::<standard>_deviation_next_line(<code-identifier>)- this deviation applies to results on the next line.codeql::<standard>_deviation_begin(<code-identifier>)- marks the beginning of a range of lines where the deviation applies.codeql::<standard>_deviation_end(<code-identifier>)- marks the end of a range of lines where the deviation applies.This would address#326.
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 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.