jendrikseipp / vulture

Find dead Python code
MIT License
3.38k stars 148 forks source link

Detect unused local variables? #274

Closed ChillarAnand closed 2 years ago

ChillarAnand commented 2 years ago
def foo():
    x = 2
    x = 3
    print(x)

print(foo())

In the above code, x = 2 is local unused variable but vulture doesn't detect it currently. May be vulture can detect and report these?

jendrikseipp commented 2 years ago

That would be possible, yes, but it would require a substantial amount of changes to the core of Vulture. So currently there are no plans to do that. But I think flake8 should detect cases like this.