-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Shared and Sync: Fix some Ql4Ql violations. #20335
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
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 fixes several Ql4Ql violations by addressing code quality issues identified by static analysis checks including field usage, naming conventions, control flow, and documentation.
Key changes include:
- Improved control flow structure by replacing
if-else-nonepattern with more explicit conditional logic - Enhanced module naming by giving descriptive names to generic module variables
- Added missing parameter documentation for better code clarity
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll | Refactored nested if-else-none pattern to use explicit conditional logic |
| shared/quantum/codeql/quantum/experimental/Model.qll | Fixed spelling error and removed unused field variable |
| shared/dataflow/codeql/dataflow/TaintTracking.qll | Renamed generic module names to be more descriptive |
| shared/dataflow/codeql/dataflow/DataFlow.qll | Renamed generic module variable C to descriptive StateConfig |
| ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModelsExtensions.qll | Added missing parameter documentation for madId |
| python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModelsExtensions.qll | Added missing parameter documentation for madId |
| javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsExtensions.qll | Added missing parameter documentation for madId |
| abstract class ArtifactConsumer extends ConsumerElement { | ||
| /** | ||
| * Use `getAKnownArtifactSource() instead. The behaviour of these two predicates is equivalent. | ||
| * Use `getAKnownArtifactSource() instead. The behavior of these two predicates is equivalent. |
Copilot
AI
Sep 2, 2025
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.
Good correction of 'behaviour' to 'behavior' for American English consistency.
| */ | ||
| module Global<ConfigSig Config> implements GlobalFlowSig { | ||
| private module C implements FullStateConfigSig { | ||
| private module StateConfig implements FullStateConfigSig { |
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.
Please revert. It's a short-scoped private name, and making it longer may excessively bloat the length of DIL/RA names.
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.
Hmm, I was not aware that this was a concern! Thx!
| */ | ||
| module GlobalWithState<StateConfigSig Config> implements GlobalFlowSig { | ||
| private module C implements FullStateConfigSig { | ||
| private module StateConfig implements FullStateConfigSig { |
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.
same
| private import MakeImplStage1<Location, DataFlowLang> as DataFlowInternalStage1 | ||
|
|
||
| private module AddTaintDefaults<DataFlowInternal::FullStateConfigSig Config> implements | ||
| private module MakeAddTaintDefaultsConfig<DataFlowInternal::FullStateConfigSig Config> implements |
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.
Revert? I don't see a good reason for this change. Also, the double verb prefix becomes awkward. Whatever QL4QL rule that demands all modules implementing a data flow config to end in Config should instead be more lenient.
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.
Fair enough, I will revert it. However, I do think that the existing name is slightly confusing. The parameterized module is used to "make" a config module (maybe a better name is MakeTaintDefaultsConfig). In any case, I will just revert the change.
|
|
||
| private module C implements DataFlowInternal::FullStateConfigSig { | ||
| import AddTaintDefaults<Config0> | ||
| private module AddTaintDefaultsConfig implements DataFlowInternal::FullStateConfigSig { |
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.
revert.
|
|
||
| private module C implements DataFlowInternal::FullStateConfigSig { | ||
| import AddTaintDefaults<Config0> | ||
| private module AddTaintDefaultsConfig implements DataFlowInternal::FullStateConfigSig { |
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.
same
| else ( | ||
| semNegative(x) and | ||
| upper = false and | ||
| delta = D::fromInt(0) |
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.
Revert. This change breaks the uniformity of the code pattern above.
aschackmull
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.
I'd like most of these changes reverted, please.
7ec6444 to
4caae6b
Compare
4caae6b to
7490d8d
Compare
Fix some Ql4Ql violations based on the following checks
ql/field-only-used-in-charpredql/could-be-castql/counting-to-zeroql/dataflow-module-naming-conventionql/if-with-noneql/missing-parameter-qldocql/misspelling