-
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
Add autofixit for B004 #3545
Comments
Ah, I just found an edge case that makes this a bit more complex to autofix:
Is also flagged. I am not sure if this is a bug from flake8-bugprone or if it wants us to replace it with
|
We could ignore the complex case. |
Agreed, we should be able to fix these. |
Hi, I'd like to take this up! |
@glokta1 - Awesome! Please ask me here or on Discord if you have questions. |
Unrelated. |
There's a link in the README! Clicking this should work: https://discord.com/invite/c9MhzV8aU5 |
## Summary Adds autofix for `hasattr` case of B004. I don't think it's safe (or simple) to implement it for the `getattr` case because, inter alia, calling `getattr` may have side effects. Fixes #3545 ## Test Plan Existing tests were sufficient. Updated snapshots
## Summary Adds autofix for `hasattr` case of B004. I don't think it's safe (or simple) to implement it for the `getattr` case because, inter alia, calling `getattr` may have side effects. Fixes astral-sh#3545 ## Test Plan Existing tests were sufficient. Updated snapshots
## Summary Adds autofix for `hasattr` case of B004. I don't think it's safe (or simple) to implement it for the `getattr` case because, inter alia, calling `getattr` may have side effects. Fixes #3545 ## Test Plan Existing tests were sufficient. Updated snapshots
This check seems autofixable with minimal chance of being an incorrect fixit. I would recommend enabling autofixes for this check by using
callable(x)
when possible instead ofhasattr(x, "__call__")
. Should be a good first issue for someone to implement.The text was updated successfully, but these errors were encountered: