jendrikseipp/vulture

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

johndoknjas opened this issue · 0 comments

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.