Skip to content
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

F-string formatting adds unnecessary space after ** operator #14487

Open
dhruvmanila opened this issue Nov 20, 2024 · 4 comments · May be fixed by #14489
Open

F-string formatting adds unnecessary space after ** operator #14487

dhruvmanila opened this issue Nov 20, 2024 · 4 comments · May be fixed by #14489
Labels
bug Something isn't working formatter Related to the formatter preview Related to preview mode features

Comments

@dhruvmanila
Copy link
Member

dhruvmanila commented Nov 20, 2024

Consider the following source code:

f"aaaaaaaaaaaaaaaaaaaaaaaaaa {10**27} bbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc"

Running ruff format --preview:

f"aaaaaaaaaaaaaaaaaaaaaaaaaa {10** 27} bbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc"

Playground: https://play.ruff.rs/80926d6e-f183-4631-94ce-f1702502a0e0

Found in #14454 (comment)

@dhruvmanila dhruvmanila added bug Something isn't working formatter Related to the formatter preview Related to preview mode features labels Nov 20, 2024
@MichaReiser
Copy link
Member

Huh, that's weird

@MichaReiser
Copy link
Member

Oh, is it because of the inner group and the entire line exceeds the line length. We might need to remove if_group_breaks from RemoveSoftLinesBuffer

@MichaReiser
Copy link
Member

this could be annoying

@dhruvmanila
Copy link
Member Author

Oh, is it because of the inner group and the entire line exceeds the line length.

Yeah, and we use RemoveSoftLinesBuffer but that doesn't remove the space as you've mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter Related to the formatter preview Related to preview mode features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants