Skip to content

Go: fix some FPs in go/whitespace-contradicts-precedence - #22675

Open
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:go/fix/whitespace-contradicts-precedence-parentheses
Open

owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:go/fix/whitespace-contradicts-precedence-parentheses

Conversation

@owen-mc

@owen-mc owen-mc commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

This fixes a bug where parenthesized expressions were not excluded from go/whitespace-contradicts-precedence. This query had to be updated because we stopped extracting ParenExpr in #22182 (and started putting that information in a separate table in #22605). The old version of the query excluded ParenExpr, but not explicitly. A test has been added to demonstrate the bug and show that it is fixed.

This does not need a change note as it is fixing FPs that haven't been in any release.

@owen-mc
owen-mc requested a review from a team September 24, 2026 10:19
@owen-mc
owen-mc requested a review from a team as a code owner September 24, 2026 10:19
Copilot AI balanced review requested due to automatic review settings September 24, 2026 10:19
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Sep 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The query fix and its regression test are focused, and no unresolved issues remain.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes false positives in the Go whitespace-precedence query for explicitly parenthesized expressions.

Changes:

  • Excludes parenthesized nested operands using extracted parenthesis metadata.
  • Adds regression coverage for a non-alerting parenthesized expression.
File Description
go/​ql/​test/​query-tests/​InconsistentCode/​WhitespaceContradictsPrecedence/​ParenthesizedOperands.go Adds regression coverage for parenthesized operands.
go/​ql/​src/​InconsistentCode/​WhitespaceContradictsPrecedence.ql Filters explicitly parenthesized nested expressions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the Go label Sep 24, 2026

This branch has not been deployed

No deployments
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