-
Notifications
You must be signed in to change notification settings - Fork 148
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
Feature request: A way to more specifically target items for whitelisting #343
Comments
I've started using vulture a few days ago and I've run into the same problem. Sometimes we just implement new features incrementally and therefore leave sections of code unused for a few commits. |
yeah, definitely need something. I thought I had a solution and wrote a tool to generate a whitelist. Not too crazy and mostly introspection based. Then I realized that once the white list lets any class have a method every other class ALSO is allowed to have that method. In other words:
Now have an actually unused |
I'm trying to implement Vulture for a big project at work that uses a proprietary application framework.
Entrypoints into the application are classes with a specific name (
Main
) that are subclasses of a specific framework class (acme_corp.application.Service
) placed in a very specifically named module (e.g.my_package_name/main.py
). The framework also has hooks, which are defined as methods with very specific names in subclasses of a specific framework class.This is a very large codebase, and simply whitelisting the names
Main
,_.before
,_.after
etc. is likely to hit much more than just the entrypoints that I want to whitelist.It would be tremendously useful if Vulture leveraged the AST to allow even more specific whitelists. You could take into account the type of object (if it's a constant, variable, class, method, function etc.), the location (file name, module name, package name), the base classes and so on.
To maintain backwards compatability, this could be added as a new feature, for example:
pyproject.toml:
Alternative names:
mark_used
,tag
, (?)The text was updated successfully, but these errors were encountered: