-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Labels
formatterRelated to the formatterRelated to the formatterpreviewRelated to preview mode featuresRelated to preview mode featuresstyleHow should formatted code lookHow should formatted code look
Description
Implement Black's parenthesize_conditional_expressions
style as a preview style in Ruff.
Note: This new style might not be accepted as part of Black's 2024 style guide.
Unformatted:
[
"____________________________",
"foo",
"bar",
"baz" if some_really_looooooooong_variable else "some other looooooooooooooong value"
]
Formatted (Black stable, Ruff):
[
"____________________________",
"foo",
"bar",
"baz"
if some_really_looooooooong_variable
else "some other looooooooooooooong value",
]
Formatted (Black preview):
[
"____________________________",
"foo",
"bar",
(
"baz"
if some_really_looooooooong_variable
else "some other looooooooooooooong value"
),
]
When it fits again...
Formatter (Ruff, Black stable, Black preview):
[
"____________________________",
"foo",
"bar",
("baz" if some_really_looooooooong_variable else "some other loooooooooong value"),
]
Arguably, these should be removed to ensure the formatting is reversible.
Metadata
Metadata
Assignees
Labels
formatterRelated to the formatterRelated to the formatterpreviewRelated to preview mode featuresRelated to preview mode featuresstyleHow should formatted code lookHow should formatted code look