-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Catch variable is []
#8589
Labels
Comments
It seems reasonable to me. |
Although maybe it should be a different rule if we want to also test for |
Seems ok to fold it into the same rule for me, since that will also always be false, right? |
Could this be expanded to cover any of the mutable initialisers? E.g set, dict, etc? |
charliermarsh
pushed a commit
that referenced
this issue
Nov 11, 2023
…8607) ## Summary Adds an extra check to F632 to check for any `is` comparisons to a mutable initialisers. Implements #8589 . Example: ```Python named_var = {} if named_var is {}: # F632 (fix) pass ``` The if condition will always evaluate to False because it checks on identity and it's impossible to take the same identity as a hard coded list/set/dict initializer. ## Test Plan Multiple test cases were added to ensure the rule works + doesn't flag false positives + the fix works correctly.
I believe this was closed by #8607 :) Thanks @jesse1412! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Make F632 catch the following trap:
Tested in Arch Linux:
The text was updated successfully, but these errors were encountered: