-
Notifications
You must be signed in to change notification settings - Fork 2k
SIM113 only reported once per scope #24206
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
i = 0
for val in [1,2,3]:
print(f"{i}: {val}")
i += 1
i = 0
for val in [1,2,3]:
print(f"{i}: {val}")
i += 1
Only the first i += 1 is reported with SIM113. And if you fix it:
for i,val in enumerate([1,2,3]):
print(f"{i}: {val}")
i = 0
for val in [1,2,3]:
print(f"{i}: {val}")
i += 1
i += 1 is still not reported as an error. Now if you change the variable name:
for i,val in enumerate([1,2,3]):
print(f"{i}: {val}")
j = 0
for val in [1,2,3]:
print(f"{j}: {val}")
j += 1
Now j += 1 is reported with SIM113.
Version
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working