Skip to content

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.

@github-actions
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