Closed tsx closed 3 years ago
I'd say this is a bug in the rule since if one blindly just applies the change, they'll get a program that behaves differently than before.
You are completely right, this is a false-positive. SIM113 triggers way too often.
However, this issue is a duplicate of https://github.com/MartinThoma/flake8-simplify/issues/32 - sadly, I can't see a simple way to fix this issue. Maybe if there is any continue
it should not trigger?
Desired change
+=1
is executed unconditionally.Explanation
If you pre-filter the things you iterate on before adding 1 to the total, enumerate will have a different number than current total.
Example
This is an example where the mentioned rule(s) would currently be suboptimal: