-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Formatter can insert mysterious extraneous parentheses in with
statements
#14001
Comments
Thanks for reporting this. Agree, this looks silly but I'm a bit scared from fixing it... with item formatting is complicated. |
Hmm... with Ruff 0.7.2, the example I gave above is still problematic; it still wants to add extra |
Yeah, we can't fix it before promoting the new style to stable. You would have to use |
Aha; I missed that. Thanks for the clarification!!
…-------- Original Message --------
On 11/4/24 13:52, Micha Reiser wrote:
> Hmm... with Ruff 0.7.2, the example I gave above is still problematic; it still wants to add extra ( ) and fail UP034.
Yeah, we can't fix it before promoting the new style to stable. You would have to use format.preview = true for now
—
Reply to this email directly, [view it on GitHub](#14001 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABW4EY3TB6AAI6UTPRAK5FDZ67GBFAVCNFSM6AAAAABQ4NIQLOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJVGU3TKNZTHE).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
You can subscribe to #13371 to get notified when the preview style gets stabilized. |
I'm trying out 0.9.0 and still seeing this behavior. Did this make it into the 2025 style? |
Hmmm, no. That's on me. |
Not the end of the world; just wanted to make sure I wasn't missing anything obvious. Thanks. |
Thanks for being so understanding and sorry that I missed that one last preview style |
Hey @MichaReiser, I'm one of @lpulley's coworkers. Will this make it into 0.9.1? Or will we be waiting till the 2026 style? fwiw, we've been super happy with ruff and this will not change that :) Thanks for helping to build such an awesome piece of software! |
Thanks for the kind words. We might want to pull it into 0.10, considering that changes should be super rare. I don't feel comfortable shipping it as part of a patch release because it would violate our versioning policy |
Sounds good to me, thank you! |
My
ruff --version
is 0.7.1.I've encountered a case where
ruff format
adds nesting parentheses for seemingly no reason:i.e. it wants this:
UP034 complains about this, for good reason.
If the
# Bar
comment is removed, the formatter makes no changes. More curiously, if I keep# Bar
but addas _
, the formatter makes no changes. (I also checked that Black does not do this.)I've resolved the issue in the meantime by moving the
# Bar
comment to a different line, but this seems like a formatter bug.The text was updated successfully, but these errors were encountered: