-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
acceptedReady for implementationReady for implementationruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
PERF102 is not detected in generators or comprehensions, only in for loops:
d = {}
for k, _ in d.items():
print(k)
_ = (k for k, _ in d.items())
_ = [k for k, _ in d.items()]
_ = {k for k, _ in d.items()}
_ = {k: "v" for k, _ in d.items()}Running:
$ ruff --version
ruff 0.0.284
$ ruff x.py
x.py:3:13: PERF102 [*] When using only the keys of a dict use the `keys()` method
Found 1 error.
[*] 1 potentially fixable with the --fix option.
Expected: A line for the d.items() call in the generator and each of the list/set/dict comprehension.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
acceptedReady for implementationReady for implementationruleImplementing or modifying a lint ruleImplementing or modifying a lint rule