jendrikseipp/vulture

Help with ignoring decorated method

elParaguayo opened this issue · 4 comments

Hi there, I'm struggling to ignore an error flagged by vulture.

In my code I have the following method:

from dbus_next.service import method

...

@method()
def RegisterWindow(self, windowId: "u", menuObjectPath: "o"):  # type: ignore  # noqa: F821, N802, N803
    pass

vulture reports unused variable 'menuObjectPath' (100% confidence). I don't want to change the name as it's part of a spec so I have added the following line to [tool.vulture] in my pyproject.toml file: ignore_decorators = ["@method"]. However, vulture is still reporting the error. I've tried adding parentheses too with the same result.

Have I missed something obvious?

Vulture just ignores the method name, not the argument names. We're currently debating whether this should be changed in an issue.

I got caught out by a google search which included this "Additionally, the --ignore-decorators option can be used to ignore functions decorated with the given decorator."

Thanks for the reply.

It does actually say that on PyPI so you may want to fix that at some point.

Good point, thanks! Done.