Skip to content

Group comparisons across intervening comments - #922

Open
adenzhou1350 wants to merge 1 commit into
andialbrecht:masterfrom
adenzhou1350:codex/group-commented-comparisons
Open

adenzhou1350 wants to merge 1 commit into
andialbrecht:masterfrom
adenzhou1350:codex/group-commented-comparisons

Conversation

@adenzhou1350

Copy link
Copy Markdown

Fixes #604.

Comments between a comparison operator and its operand prevented the comparison from being grouped. SELECT columns then became nested identifier lists, causing subsequent columns to drift right even with strip_comments=True.

Skip existing comment tokens while finding comparison operands, but retain them inside the group. Other grouping passes keep their existing behavior. Tests cover block/line comments, hints, nested comparisons, different operand types, statement boundaries, and SELECT indentation.

Validation on Windows / Python 3.14:

  • Full suite: 521 passed, 2 xfailed, 1 xpassed; the existing xfail/xpass results are unchanged.
  • The same focused tests against the original source: 14 failed, 166 passed, 2 xfailed; against this change: 180 passed, 2 xfailed.
  • Ruff and git diff --check pass.

AI-assisted implementation, independently reproduced and checked locally. No multi-platform CI or performance claim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue with strip_comments: block comments still have an impact despite removal - unwanted indent

1 participant