Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new SIM rule SIM911: zip(dict.keys(), dict.values()) → dict.items() #9319

Closed
Skylion007 opened this issue Dec 30, 2023 · 1 comment · Fixed by #9460
Closed

Implement new SIM rule SIM911: zip(dict.keys(), dict.values()) → dict.items() #9319

Skylion007 opened this issue Dec 30, 2023 · 1 comment · Fixed by #9460
Assignees
Labels
good first issue Good for newcomers rule Implementing or modifying a lint rule

Comments

@Skylion007
Copy link

Skylion007 commented Dec 30, 2023

Flake8 simplify was updated recently and a simple, but effective new rule was added.

a = dict(...)
items = zip(a.keys(), a.values())

should instead be

items = a.items()

@dosisod Refurb might be interested in this rule as well.

@charliermarsh charliermarsh added rule Implementing or modifying a lint rule accepted Ready for implementation good first issue Good for newcomers and removed accepted Ready for implementation labels Dec 31, 2023
@trag1c
Copy link
Contributor

trag1c commented Jan 3, 2024

I'd like to work on this, please assign me :)

charliermarsh pushed a commit that referenced this issue Jan 11, 2024
## Summary

Closes #9319, implements the [`SIM911` rule from
`flake8-simplify`](MartinThoma/flake8-simplify#183).


#### Note
I wasn't sure whether or not to include
```rs
if checker.settings.preview.is_disabled() {
    return;
}
```
at the beginning of the function with violation logic if the rule's
already declared as part of `RuleGroup::Preview`.
I've seen both variants, so I'd appreciate some feedback on that :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants