Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add B020 check to find for-loop control variable overiding iter set (#…
…220) * Implement rule B020: for-loop control variable overrides iter set * Update tests/b020.py Co-authored-by: Cooper Lees <me@cooperlees.com>
- Loading branch information
1 parent
1c47a16
commit f1d1a53
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,3 +63,6 @@ target/ | |
.ipynb_checkpoints | ||
|
||
.vscode | ||
|
||
# JetBrains | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Should emit: | ||
B020 - on lines 8 and 21 | ||
""" | ||
|
||
items = [1, 2, 3] | ||
|
||
for items in items: | ||
print(items) | ||
|
||
items = [1, 2, 3] | ||
|
||
for item in items: | ||
print(item) | ||
|
||
values = {"secret": 123} | ||
|
||
for key, value in values.items(): | ||
print(f"{key}, {value}") | ||
|
||
for key, values in values.items(): | ||
print(f"{key}, {values}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters