Expand SIM118 to cover AnySequence(dict.keys())
Open
needs-decision
rule
- Dominant language
- Rust
- Stars
- 49.6k
- Forks
- 2.4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 458
Description
Would be nice if SIM118 could be expanded (or a new rule created) that not just covers iterating over dict keys but also converting them to any type of iterable:
```py
# bad
list(dict.keys())
tuple(dict.keys())
set(dict.keys())
[*dict.keys()]
{*dict.keys()}
# good
list(dict)
tuple(dict)
set(dict)
[*dict]
{*dict}
```
Contributor guide
Research direction
Start by locating the SIM118 rule and its tests in the Ruff codebase. Compare the existing dict-key iteration cases with the listed list, tuple, set, and unpacking examples. Done means the rule consistently recognizes those conversions and the tests cover the bad and good forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100