Skip to content

[Feature Request] Add new check to validate undefined variable #1376

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

Closed
moylop260 opened this issue Mar 13, 2017 · 1 comment
Closed

[Feature Request] Add new check to validate undefined variable #1376

moylop260 opened this issue Mar 13, 2017 · 1 comment

Comments

@moylop260
Copy link
Contributor

Steps to reproduce

  1. Running the following code
if False:
    new_variable = "hello"
print new_variable

We have the following error:

Traceback (most recent call last):
  File "example.py", line 3, in <module>
    print new_variable
NameError: name 'new_variable' is not defined

Current behavior

If we run a pylint to check if this error is detected early we don't have a check for this case.

Expected behavior

Emit a check similar to W0631 undefined-loop-variable - Using possibly undefined loop variable 'new_variable' but for the if section.

pylint --version output

Latest master sha for astroid and pylint

@degustaf
Copy link
Contributor

Duplicate of #85.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants