-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[ruff
] if k in d: del d[k]
(RUF051
)
#14553
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
RUF051 | 16 | 16 | 0 | 0 | 0 |
44d0d5b
to
3f33717
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
This rule would fit well into the flake8-simplify group. Would you be interested in creating an upstream issue to see if they're interested in such a rule?
Created upstream issue here. The repo has been inactive for nearly a year, so I won't hold my breath. |
Thanks for opening the upstream issue. We discussed this internally. Let's give @InSyncWithFoo feel free to ping me after a week |
ruff
] if k in d: del d[k]
(RUF041
)ruff
] if k in d: del d[k]
(RUF051
)
@MichaReiser It has been a week. What do you say? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I left a few comments related to the code.
The main question to me is if we want to add this rule to Ruff today. I see that @charliermarsh mark the rule as accepted.
To me, this seems to be mainly a stylistic rule and I personally would prefer if x in k: del k[x]
in many places. But maybe that's just because I'm unused to a dict
type to not have a remove
method. I'd be on board merging this rule if we consider using pop
is a more idiomatic writting of this pattern. @AlexWaygood what's your take on this?
I agree that using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks @AlexWaygood for the extra context (and educating me :))
I'm requesting changes for the code review feedback that I submitted earlier today
## Summary Resolves astral-sh#7537. ## Test Plan `cargo nextest run` and `cargo insta test`. --------- Co-authored-by: Micha Reiser <[email protected]>
(Accidentally introduced in #14553).
Summary
Resolves #7537.
Test Plan
cargo nextest run
andcargo insta test
.