jendrikseipp / vulture

Find dead Python code
MIT License
3.45k stars 152 forks source link

Dealing with recursive functions that are only called by themselves #354

Open johndoknjas opened 6 months ago

johndoknjas commented 6 months ago
def first() -> None:
    print('hi')

def second(recurse: bool = False) -> None:
    if recurse:
        second()

For this code snippet, vulture correctly labels first as unused, but it doesn't for second. So to see if a function is used, I'd propose not considering recursive calls.