Skip to content

Conversation

michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Sep 1, 2025

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

DCA looks good.

@github-actions github-actions bot added the Go label Sep 1, 2025
@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 07:47
@michaelnebel michaelnebel requested a review from a team as a code owner September 2, 2025 07:47
@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 07:47
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 in Go CodeQL libraries by refactoring conditional logic patterns and improving code documentation. The changes primarily eliminate if-with-none patterns by restructuring conditional expressions to use conjunctions and disjunctions instead of nested if-then-else statements.

Key changes include:

  • Refactoring nested if-then-else statements to use conjunctive conditions and disjunctions
  • Fixing documentation comments to correctly reference parameter names
  • Removing unused variables in class member declarations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
go/ql/src/experimental/IntegerOverflow/RangeAnalysis.qll Refactored conditional logic in getAnSsaUpperBound and getAnSsaLowerBound functions to eliminate nested if-then-else patterns
go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll Fixed documentation comments to correctly reference parameter g instead of generic "this node"
go/ql/lib/semmle/go/StringOps.qll Removed unused field variable f by moving it into an exists clause

(
def instanceof SsaExplicitDefinition and
exists(SsaExplicitDefinition explicitDef | explicitDef = def |
//SSA definition coresponding to a `SimpleAssignStmt`
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.

Misspelling: 'coresponding' should be 'corresponding'.

Copilot uses AI. Check for mistakes.

)
)
else (
//SSA definition coreponding to the init of the parameter
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.

Misspelling: 'coreponding' should be 'corresponding'.

Copilot uses AI. Check for mistakes.

@michaelnebel michaelnebel merged commit 9a88e38 into github:main Sep 2, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Go no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants