-
Notifications
You must be signed in to change notification settings - Fork 77
Improve NumericLiteral exclusion coverage and polish QLDoc wording #1137
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
850a1d5
Fix regex for octal literal matching
mbaluda f484080
Exclude user-defined literals and templates
mbaluda 2b15b72
add release notes
mbaluda e02b355
Potential fix for pull request finding
mbaluda acc2856
Potential fix for pull request finding
mbaluda aae7003
Use codingstandards.cpp.UserDefinedLiteral
mbaluda afe84b4
Update change_notes/2026-05-21-fix-fp-rule-5-13-4.md
mbaluda 742ef16
Initial plan
Copilot d783d8e
Add test coverage for literal exclusion cases
Copilot a165834
Rename new template exclusion test for consistency
Copilot 97eaff9
Simplify template exclusion test invocation
Copilot 30d4873
Merge branch 'main' into copilot/fix-review-comment-1135
mbaluda 5c01928
Potential fix for pull request finding
mbaluda 796d608
Fix QLDoc article in NumericLiteral comment
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| - `RULE-5-13-4`, `M2-13-3` - `UnsignedIntegerLiteralsNotAppropriatelSuffixed.ql`, `MissingUSuffix.ql`: | ||
| - Remove FPs in user-defined literals and template instantiations. | ||
| - `M2-13-3` - `cpp/autosar/missing-u-suffix`: | ||
| - Remove FPs in user-defined literals and template instantiations. | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,9 +5,20 @@ | |
| */ | ||
| module Cpp14Literal { | ||
| private import cpp as StandardLibrary | ||
| private import codingstandards.cpp.UserDefinedLiteral | ||
|
|
||
| /** An numeric literal. */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot respect the indentation
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in |
||
| abstract class NumericLiteral extends StandardLibrary::Literal { } | ||
| abstract class NumericLiteral extends StandardLibrary::Literal { | ||
| NumericLiteral() { | ||
|
Comment on lines
+8
to
+12
|
||
| // exclude user-defined literals as they define custom suffixes | ||
| not exists(StandardLibrary::FunctionCall fc | | ||
| this = fc.getArgument(0) and | ||
| fc.getTarget() instanceof UserDefinedLiteral | ||
| ) and | ||
| // exclude literals derived from template instantiations | ||
| not this.isFromTemplateInstantiation(_) | ||
| } | ||
| } | ||
|
|
||
| /** Convenience for implementing class `UnrecognizedNumericLiteral` */ | ||
| abstract private class RecognizedNumericLiteral extends StandardLibrary::Literal { } | ||
|
|
||
36 changes: 18 additions & 18 deletions
36
...literalsnotappropriatelysuffixed/UnsignedIntegerLiteralsNotAppropriatelySuffixed.expected
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| | test.cpp:111:3:111:12 | 2147483648 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:116:3:116:20 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:139:3:139:21 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:162:3:162:21 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:185:3:185:22 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:208:3:208:22 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:227:3:227:14 | 2147483648 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:232:3:232:25 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:249:3:249:26 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:266:3:266:26 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:283:3:283:27 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:300:3:300:27 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:315:3:315:36 | 2147483648 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:322:3:322:68 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:365:3:365:69 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:412:3:412:69 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:457:3:457:70 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:502:3:502:70 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:126:3:126:12 | 2147483648 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:131:3:131:20 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:154:3:154:21 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:177:3:177:21 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:200:3:200:22 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:223:3:223:22 | 9223372036854775808 | Hex literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:242:3:242:14 | 2147483648 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:247:3:247:25 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:264:3:264:26 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:281:3:281:26 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:298:3:298:27 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:315:3:315:27 | 9223372036854775808 | Octal literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:330:3:330:36 | 2147483648 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:337:3:337:68 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:380:3:380:69 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:427:3:427:69 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:472:3:472:70 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | | ||
| | test.cpp:517:3:517:70 | 9223372036854775808 | Binary literal is an unsigned integer but does not include a 'U' suffix. | |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.