MartinThoma / flake8-simplify

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

[New Rule] match with same arms #194

Open sbrugman opened 2 months ago

sbrugman commented 2 months 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")