-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
redefined-outer-name
no longer emitted in nested loops
#6803
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
Comments
Thanks for the report. This was an intentional design decision, because there were inconsistencies with how pylint treated overwriting loop variables. (We were special casing nested loops only.) To retain this check you need to enable the optional |
How do I re-enable the check? I tried adding:
as well as:
and even:
but none of these work. |
The doc got better this release too : https://pylint.pycqa.org/en/latest/user_guide/messages/warning/redefined-loop-name.html?highlight=redefined-loop-name 😄 |
I think the issue is that you're using |
Yes, that's the issue. This command works:
@Pierre-Sassoulas @DanielNoord , no I don't see an error with |
redefined-outer-name
no longer emitted in nested loops
Opened #6810 to address this |
I confirm I can again get the warning with the suggestion above. Thank you! |
Bug description
The following Python code contains a redefined variable (instrument) in the inner loop:
Pylint 2.13 correctly detects the error with the following message:
However, Pylint 2.14 fails to detect it.
Configuration
No response
Command used
Pylint output
Expected behavior
Output:
************* Module test
test.py:5:8: W0621: Redefining name 'instrument' from outer scope (line 3) (redefined-outer-name)
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: