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

False negative when two locals or a class attribute and global have the same name #371

Open
johndoknjas opened this issue Oct 5, 2024 · 0 comments

Comments

@johndoknjas
Copy link
Contributor

johndoknjas commented Oct 5, 2024

def f():
    pass

x = 6

class F:
    x = 5
    def f():
        pass

print(F.x)
F.f()

Vulture doesn't give any unused notifications for the global var or function. The reason is that they are represented by the same string in self.used_names.

An example with two locals:

def f():
   i = 0
   if i:
      print('hi')

def g():
   i = 0

f()
g()

For this one, vulture will not say the i in g() is unused, due to the i in f() being used.

@johndoknjas johndoknjas changed the title False negative when method and function have the same name False negative when a class attribute and global have the same name Oct 5, 2024
@johndoknjas johndoknjas changed the title False negative when a class attribute and global have the same name False negative when two locals or a class attribute and global have the same name Oct 23, 2024
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

Successfully merging a pull request may close this issue.

1 participant