Skip to content

[flake8-comprehensions] Parenthesize sorted when needed for unnecessary-call-around-sorted (C413)#15825

Merged
dylwil3 merged 3 commits intoastral-sh:mainfrom
dylwil3:sorted-call
Jan 30, 2025
Merged

[flake8-comprehensions] Parenthesize sorted when needed for unnecessary-call-around-sorted (C413)#15825
dylwil3 merged 3 commits intoastral-sh:mainfrom
dylwil3:sorted-call

Conversation

@dylwil3
Copy link
Copy Markdown
Collaborator

@dylwil3 dylwil3 commented Jan 30, 2025

If there is any ParenthesizedWhitespace (in the sense of LibCST) after the function name sorted and before the arguments, then we must wrap sorted with parentheses after removing the surrounding function.

Closes #15789

@dylwil3 dylwil3 added bug Something isn't working fixes Related to suggested fixes for violations labels Jan 30, 2025
@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice!

@dylwil3 dylwil3 merged commit 13cf3e6 into astral-sh:main Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixes Related to suggested fixes for violations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C413 fix is wrong when a newline appears between sorted and the opening parenthesis

2 participants