MartinThoma / flake8-simplify

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

[Adjust Rule] SIM111 - Detect if another statement comes after the loop #62

Closed kasium closed 2 years ago

kasium commented 3 years ago

Desired change

Explanation

The below code is flagged with SIM111, but if I would would use the suggested code, the call_method call would be lost.

Example

for a in my_list:
  if a == 2:
    return False
call_method()
return True
MartinThoma commented 2 years ago

Sorry that this took so long. I'll make a release with this fix today :crossed_fingers: