8000 [`pyupgrade`] Add spaces between tokens as necessary to avoid syntax errors in `UP018` autofix by LaBatata101 · Pull Request #17648 · astral-sh/ruff · GitHub
[go: up one dir, main page]

Skip to content

[pyupgrade] Add spaces between tokens as necessary to avoid syntax errors in UP018 autofix #17648

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

Merged
merged 3 commits into from
May 7, 2025

Conversation

LaBatata101
Copy link
Contributor

Summary

Is it better to add another edit in the fix to add the space, or this is fine?
https://github.com/LaBatata101/ruff/blob/032bd2edcb7a3576ac0a69fd193a675639b5ea0e/crates/ruff_linter/src/rules/pyupgrade/rules/native_literals.rs#L284-L286

Fixes #17606

Test Plan

Snapshot tests.

8000
Copy link
Contributor
github-actions bot commented Apr 26, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood AlexWaygood added bug Something isn't working fixes Related to suggested fixes for violations labels Apr 27, 2025
@LaBatata101 LaBatata101 changed the title [pyupgrade] Add spaces between tokens as necessary to avoid syntax errors in UP018 fix [pyupgrade] Add spaces between tokens as necessary to avoid syntax errors in UP018 autofix Apr 27, 2025
Copy link
Member
@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

I think what you did is fine. I'm somewhat inclined to instead look at the parent_expr but I can see that this might be harder (simply because we already use it in the check)

@LaBatata101 LaBatata101 requested a review from MichaReiser May 3, 2025 19:39
@MichaReiser MichaReiser merged commit c504001 into astral-sh:main May 7, 2025
34 checks passed
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.

UP018 fix should add spaces between tokens
3 participants
0