MartinThoma / flake8-simplify

❄ A flake8 plugin that helps you to simplify code
MIT License
185 stars 19 forks source link

[New Rule] match with same arms #194

Open sbrugman opened 1 week ago

sbrugman commented 1 week ago

Explanation

Implement the checking for branches with identical arm bodies for match Same benefits as https://github.com/MartinThoma/flake8-simplify/issues/10

Python 3.10+

Example

# Bad
match hello:
   case "world":
        print("world")
    case "foobar":
       print("world")

# Good

match hello:
   case "world" | "foobar":
       print("world")