-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatter
Milestone
Description
Version: 0.1.1
Command: ruff format --isolated example.py
Playground: Example
Example
def fizzbuzz(n):
match n % 3, n % 5:
case 0, 0:
# n is divisible by both 3 and 5
print("FizzBuzz")
case 0, _:
# n is divisible by 3, but not 5
print("Fizz")
case _, 0:
# n is divisible by 5, but not 3
print("Buzz")
case _:
print(n)This is formatted to
def fizzbuzz(n):
match (
n % 3,
n % 5,
# n is divisible by both 3 and 5
# n is divisible by 3, but not 5
# n is divisible by 5, but not 3
):
case 0, 0:
print("FizzBuzz")
case 0, _:
print("Fizz")
case _, 0:
print("Buzz")
case _:
print(n)Adding parentheses around the matched tuple (match n % 3, n % 5 -> match (n % 3, n % 5)) results in expected formatting.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatter