MartinThoma / flake8-simplify

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

[Adjust Rule] SIM113 should not trigger when adding a non-number #55

Closed akx closed 3 years ago

akx commented 3 years ago

Desired change

Explanation

Just looking at whether a variable is being incremented in a loop isn't enough to consider enumerate().

Example

This triggers SIM113 Use enumerate instead of 'line':

for line in read_list(redis_conn, storage_key):
    line += b'\n'
    # ....
MartinThoma commented 3 years ago

Thank you for reporting this! This seems easy to fix; I'll probably do it tomorrow evening :-)