-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Rule proposal: in-empty-collection
#16569
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
Comments
in-empty-collection
I think having this as a rule does make sense. What would you suggest as proposed fix? |
I'm personally happy with the rule, was just checking boxes - sorry for the bureaucratic red tape! @naslundx would you like to sync with main, respond to the remaining comments on the PR and we can get this landed? |
On the name semantics, Btw sequences are collections with a few extra methods. So the originally proposed name |
Actually, any empty |
Resolved in #16480 |
Summary
After discussions in #15732 and #15729 an idea was proposed to add a rule for checking unnecessary membership test in empty collections.
This would reinstate the old behavior in rule PLR6201 to explicitly check for things like
if 1 in []
orif 'a' not in ''
.Should ruff include it?
Example implementation is here: #16480
The text was updated successfully, but these errors were encountered: