-
Notifications
You must be signed in to change notification settings - Fork 2k
Possible false negative on PLR1736 #13183
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
The following example I would expect to be recognised by PLR1736
Minimal reproducible example:
data = {"a": 1, "b": 2}
column_names = ["a", "b"]
for index, column_name in enumerate(column_names):
_ = data[column_names[index]]Command:
ruff check --isolated --select PLR1736 examples/plr.py
Output:
All checks passed!
Expected output:
examples/plr.py:8:8: PLR1736 [*] List index lookup in `enumerate()` loop
|
7 | for index, column_name in enumerate(column_names):
8 | _ = data[column_names[index]]
| ^^^^^^^^^^^^^^^^^^^^ PLR1736
|
= help: Use the loop variable directly
Version: ruff 0.6.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule