-
Notifications
You must be signed in to change notification settings - Fork 155
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
Skip functions decorated with abc.abstractmethod #317
Comments
You can use |
thanks for your response @jendrikseipp ! for some reason it is not working: $ vulture --min-confidence 80 --ignore-decorators @abc.abstractmethod src/arxir/builders/base.py
src/arxir/builders/base.py:59: unused variable 'output_file' (100% confidence) 58 @abc.abstractmethod
59 def build(self, expr: ast.AST, output_file: str) -> None:
60 ...
61 I am using the latest version: $ vulture --version
vulture 2.9.1 any thoughts? |
Currently, |
not sure if I understood i correctly, but my case is very simple, abc.abstractmethod defines a method that will be overridden, that means that that function doesn't need to have any code inside, so any argument don't need to be used inside the function. In my example above, it just uses so, in this case, the vulture will alert that that variable (argument) is not used with 100% of confidence. it would be nice to have some way to skip any argument of functions decorated by abc.abstractmethod .. or at least a generic way to do that where I can configure to skip any functions and their arguments decorated by a specific decorator (but not the functions that override the original ones). |
I don't know enough about the |
I understand that class Logger(ABC):
@abstractmethod
def log(self, message: str, arg1: int) -> None:
raise NotImplementedError() It should not complain about unused |
hey everyone!
I am new to vulture, and maybe there is a nice way to do that already, but something that I saw that maybe could be done automatically is to skip methods that is decorated by abc.abstractmethod.
for now I am just using
noqa
to skip that, Although I saw that is preferred to use whitelist .. but at least for now, I think thatnoqa
would be simpler than adding a new file to the repo.thank you so much!
The text was updated successfully, but these errors were encountered: