Skip to content

Conversation

michaelnebel
Copy link
Contributor

Fix some Ql4Ql violations based on the following checks

  • ql/field-only-used-in-charpred
  • ql/could-be-cast
  • ql/counting-to-zero
  • ql/dataflow-module-naming-convention
  • ql/if-with-none
  • ql/missing-parameter-qldoc
  • ql/misspelling

@michaelnebel michaelnebel added the no-change-note-required This PR does not need a change note label Sep 2, 2025
@michaelnebel michaelnebel marked this pull request as ready for review September 2, 2025 08:09
@michaelnebel michaelnebel requested review from a team as code owners September 2, 2025 08:09
@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 08:09
Copy link
Contributor

@Copilot Copilot AI left a 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-none pattern 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

@@ -365,7 +365,7 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
*/
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.
Copy link
Preview

Copilot AI Sep 2, 2025

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.

Copilot uses AI. Check for mistakes.

@@ -695,7 +695,7 @@ module DataFlowMake<LocationSig Location, InputSig<Location> Lang> {
* Constructs a global data flow computation.
*/
module Global<ConfigSig Config> implements GlobalFlowSig {
private module C implements FullStateConfigSig {
private module StateConfig implements FullStateConfigSig {
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@@ -719,7 +719,7 @@ module DataFlowMake<LocationSig Location, InputSig<Location> Lang> {
* Constructs a global data flow computation using flow state.
*/
module GlobalWithState<StateConfigSig Config> implements GlobalFlowSig {
private module C implements FullStateConfigSig {
private module StateConfig implements FullStateConfigSig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -56,7 +56,7 @@ module TaintFlowMake<
private import MakeImpl<Location, DataFlowLang> as DataFlowInternal
private import MakeImplStage1<Location, DataFlowLang> as DataFlowInternalStage1

private module AddTaintDefaults<DataFlowInternal::FullStateConfigSig Config> implements
private module MakeAddTaintDefaultsConfig<DataFlowInternal::FullStateConfigSig Config> implements
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@@ -98,15 +98,15 @@ module TaintFlowMake<
}
}

private module C implements DataFlowInternal::FullStateConfigSig {
import AddTaintDefaults<Config0>
private module AddTaintDefaultsConfig implements DataFlowInternal::FullStateConfigSig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert.

@@ -132,15 +132,15 @@ module TaintFlowMake<
}
}

private module C implements DataFlowInternal::FullStateConfigSig {
import AddTaintDefaults<Config0>
private module AddTaintDefaultsConfig implements DataFlowInternal::FullStateConfigSig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 787 to 790
else (
semNegative(x) and
upper = false and
delta = D::fromInt(0)
Copy link
Contributor

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.

Copy link
Contributor

@aschackmull aschackmull left a 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.

@michaelnebel michaelnebel merged commit 3185298 into github:main Sep 2, 2025
50 checks passed
@michaelnebel michaelnebel deleted the shared/ql4ql branch September 2, 2025 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS no-change-note-required This PR does not need a change note Python Ruby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants