Open jamilraichouni opened 2 years ago
Yes, this is a very good idea. For serious purposes, one uses at least several static checkers, each good in its own way, and what you suggest would be truly helpful.
Seeing that we already support # noqa
for some particular flake8 codes (like F401: module imported but unused
and F841: local variable is assigned to but never used
), I don't see a reason why we shouldn't support this.
I'll be happy to work out a pull request once we get a confirmation from @jendrikseipp.
I'm not opposed to adding such functionality. However, I'm not yet convinced that such a feature is useful. Your example @jamilraichouni would ignore unused arguments for all functions (assuming that V123 is the code for unused arguments). At the same time, you explicitly add flake8-unused-arguments to catch them. Isn't that a contradiction? Can you post an example where ignoring Vulture error codes would be helpful for you?
In my case I have a python package with functions made available to end-users, but which I don't necessarily use in my own code. I'd like to be able to ignore unused-function
errors and just catch unused-variable
errors.
I combine
flake8
andvulture
and want to usevulture
for stuff that is not being found byflake8
. The issue is that there are cases where I get two problems reported for one and the same issue in the code.Example:
Here
flake8
including the plugin (flake8-unused-arguments
) reports an unused argument andvulture
also reports the same unused variable with 100% confidence.It would be great to be able to fine-tune that like it is possible for
flake8
(e. g. in thetox.ini
) via stuff like that:Hence, you may want to introduce violation codes that can be ignored in the
pyproject.toml
. For instance:Many thanks! Jamil