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
Make global-variable-not-assigned
check local scope
#4990
Make global-variable-not-assigned
check local scope
#4990
Conversation
This checker now checks whether the names after the global keyword are reassigned in the local scope. This closes pylint-dev#1375
Pull Request Test Coverage Report for Build 1224244856
💛 - Coveralls |
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 have a small nitpick but this is great :)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
for more information, see https://pre-commit.ci
This checker now also checks function defintions in the module and local scope This closes pylint-dev#330
Sorry for adding changes after your review, but I stumbled upon #330 and it felt weird not to fix it in the same PR. Because #330 also indicated that function definition in the module scope were not picked up on by the check for |
Don't worry, thank you for fixing another problem :) |
doc/whatsnew/<current release.rst>
.Type of Changes
Description
This checker now checks whether the names after the global keyword are reassigned in the local scope.
I created a small
utils
function that checks whether the name appears in any of theAssignName
nodes in the scope.The updated test only throws an error for 2 of the 4 variables. Not quite sure what that is about and we might want to make another issue/PR to fix that. However, since the change did not break any of the tests the file is designed for I guessed it was okay for now. This PR does fix the original issue.
This closes #1375
This closes #330