Skip to content
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

Separate check for possibly unused variables if locals() is used #1909

Closed
danijar opened this issue Mar 3, 2018 · 1 comment
Closed

Separate check for possibly unused variables if locals() is used #1909

danijar opened this issue Mar 3, 2018 · 1 comment
Labels
Enhancement ✨ Improvement to a component

Comments

@danijar
Copy link

danijar commented Mar 3, 2018

It would be great to have a separate check for unused variables if locals() is used in the same scope:

def example_no_locals():
  value = 42  # pylint: disable=unused-variable

def exmaple_defined_before():
  value = 42  # pylint: disable=possibly-unused-variable
  print(locals())

def exmaple_defined_after():
  print(locals())
  value = 42  # pylint: disable=unused-variable

The benefit of this is that one can disable probably-unused-variable for a file (that has a lot of string formatting in it, or the config code example in #641) or the whole project without also loosing checks for unused-variable.

@PCManticore PCManticore added the Enhancement ✨ Improvement to a component label Mar 5, 2018
@danijar
Copy link
Author

danijar commented Apr 2, 2018

@PCManticore Thanks a lot for working on this!

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

No branches or pull requests

2 participants