-
-
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
Account for more node types in handling of except block homonyms with comprehensions #6073
Account for more node types in handling of except block homonyms with comprehensions #6073
Conversation
Fixes a false positive for `used-before-assignment`.
Pull Request Test Coverage Report for Build 2081793733
💛 - Coveralls |
Subscript
and Compare
to homonym handling for except blocks and comprehensions
Subscript
and Compare
to homonym handling for except blocks and comprehensions
I'm testing another approach. Less whackamole. |
Close, but couldn't avoid breaking this test. Back to whackamole. |
Ah, okay, I do have another diff that works. |
Hi @skshetry, I looked for an approach that didn't involve special-casing each type of |
anyone is welcome to review, just hitting the button to dismiss the now moot review! |
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.
I don't see any problem here, but I'm really out of touch with used-before-assignment at this point 😄 I'm wondering if astroid could help with multiple imbricated scopes in a generic "simpler" way. How is it done in other linter ? Is it supposed to be that hard ? Is there an issue with the representation of the AST ? Maybe a state of the art could help ?
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.
I like this approach! Well done figuring it out!
Thanks, you inspired me to delete more code in e35d1da. |
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.
Only the return type needs to be added 😄
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
unused-variable
for homonyms between comprehension variable and outer container
#6136
… comprehensions (#6073) Fixes a false positive for `used-before-assignment`. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Type of Changes
Description
Several nodes types didn't meet the allow list for homynym handling b/w except blocks and comprehensions.
Closes #6069