-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
acceptedReady for implementationReady for implementationformatterRelated to the formatterRelated to the formatterstyleHow should formatted code lookHow should formatted code look
Description
Ruff avoids adding parentheses to expressions that start or end with a parenthesized node (see can_omit_parentheses).
This is implemented by using optional_parentheses in conjunction with the in_parentheses_only_* builders. We need something similar for patterns to support
match test:
case A | B | ["Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"]: ...
# Formatted
match test:
case (
A
| B
| ["Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"]
):
...
# Instead of
match test:
case A | B | [
"Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
]:
...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
acceptedReady for implementationReady for implementationformatterRelated to the formatterRelated to the formatterstyleHow should formatted code lookHow should formatted code look