vulture icon indicating copy to clipboard operation
vulture copied to clipboard

ignore click functions

Open davetapley opened this issue 9 months ago • 3 comments

Would a feature be welcome to detect and ignore click methods?

I already have them all grouped in a cli/ sub-dir which I can --exclude, but it would be nice if Vulture could figure it out 😁


I think it'll require more than just adding to whitelists/ since the names are arbitrary, but...

Since click uses a decorator which makes the functions an instance of click.Command, I think it could be as easy as:

@cli.command()
def sync():
    click.echo('Syncing')

def unused():
   print('I am unused)

from click import Command

isinstance(sync, Command)
# True

isinstance(unused, Command)   
# False

... and in a find_spec check to see if the click is available.

davetapley avatar Sep 30 '23 00:09 davetapley