-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Go: Fix some Ql4Ql violations. #20327
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 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` |
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.
Misspelling: 'coresponding' should be 'corresponding'.
Copilot uses AI. Check for mistakes.
) | ||
) | ||
else ( | ||
//SSA definition coreponding to the init of the parameter |
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.
Misspelling: 'coreponding' should be 'corresponding'.
Copilot uses AI. Check for mistakes.
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.