Skip to content

Fix dedent with multiple leading comments - #29382

Merged
ntBre merged 3 commits into
astral-sh:mainfrom
mmaxjr:fix/29381-dedent-comments
Oct 14, 2026
Merged

ntBre merged 3 commits into
astral-sh:mainfrom
mmaxjr:fix/29381-dedent-comments

Conversation

@mmaxjr

@mmaxjr mmaxjr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fix unsafe dedent behavior when multiple leading comments are present. Added regression coverage for the affected indentation cases.

Fixes #29381.

@ntBre

ntBre commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Is this related to an open issue?

@mmaxjr

mmaxjr commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Yes. This PR addresses issue #29381, which reports incorrect indentation in safe fixes when the else body starts with multiple comments.

@ntBre ntBre added the bug An issue describing something that isn't working, or a PR that fixes a bug label Oct 14, 2026
@astral-sh-bot

astral-sh-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@ntBre ntBre 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.

Thanks

@ntBre ntBre changed the title [trivia] Fix dedent with multiple leading comments Fix dedent with multiple leading comments Oct 14, 2026
@ntBre
ntBre enabled auto-merge (squash) October 14, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Safe fixes for RET505–RET508 and PLW0120 mis-indent an else body that starts with two or more comments

2 participants