-
-
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
False positive for global-variable-not-assigned when using with #5073
Comments
Is it true that the It's worth noting that variables qualified by |
Is the global statement required here? What happens if it's removed? |
@nickdrozd @timmartin The However, I still think raising "global-variable-not-assigned error" is not right here. It is assigned (in the global scope) and it cannot be reassigned by the |
I don't understand. You're saying that the Perhaps the name |
Right, I think a documentation update could be made to clarify it. Currently the message is not explicit about where the assignment is expected (in the same block as the global statement). |
Perhaps change the message to something like |
I agree and I think your second example is a good clear and simple way to go. |
Bug description
Configuration
No response
Command used
Pylint output
Expected behavior
Pylint realizes that "with" may change the global variable and thus counts it like it was an assignment, and thus does not raise the issue in this case.
Pylint version
OS / Environment
macOS
Additional dependencies
Output of pipdeptree:
pylint==1.6.4
The text was updated successfully, but these errors were encountered: