-
Notifications
You must be signed in to change notification settings - Fork 157
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
Change the whitelist file extension in readme #182
Comments
Hello @impredicative, Thanks for the suggestions.
This is actually much more problematic, even with Let me give a more concrete example of this problem:
# foo/bar/ex1.py
def unused_func():
pass # foo/ex2.py
def unused_func();
pass Running
For ignoring only # whitelist.py
from foo.bar import ex1
ex1.unused_func But, To counter this, Vulture would need to not only compare the names of the nodes, but also the associated metadata (mainly the chain of parents' name), which would be slower, but more specific. FWIW, I'm actually in favor of the |
Also, one other fool-proof way to handle ignoring stuff is the flake8 plugin (#161), which given the interest of users, I'm now escalating from "might-do" to "will-do-in-next-week-as-soon-as-my-exams-end". |
Also, all other major static analyzers support in-line comments and exclusions, just not vulture. There is much value in supporting an in-line exclusion comment, e.g. "# vulture-off" for all the nodes in that line only. This comment would also have to be compatible with other comments for other static analyzers that could exist in the same line. |
Hi @impredicative, now that #195 has been merged, and you can use |
I would never use |
If you want to be more specific and only turn-off Vulture related issues, you can use |
That's a vulture-specific syntax, but other tools may not read that syntax, and may still disable checking for the line entirely. It's risky for me to have the word "noqa" in a comment. |
I understand your point, but we chose to go with |
Just because some other tools are doing things the wrong way doesn't mean this tool should too. Please compare with tools like Just think about it. If I want to disable a tool X for a line, why does this have to mean that I should also disable all tools that are not X? Is the logic not clear? Going with |
Please note that |
@jendrikseipp I understand that perfectly, but I also know that not all QA tools will process "V10X" as vulture expects it. There is a high risk that various other QA tools will simply skip all checks for the line after seeing the word "noqa". |
The pattern that pylint uses is |
flake8 (which is where the
That would then be a bug in that tool. Note that it'd be incompatible with flake8 as well, which is probably one of the more common Python QA tools. As another data point: It'd probably be incompatible with thousands of projects using that syntax. |
What about the whitelist file extension? If it's going to remain |
I see your point, but still think that .py is more informative about the contents of the file than .txt. I added the following note to the README file:
|
Valid Python doesn't need modifications to run. Specifically, there are no imports in |
As an aside, the |
I agree that adding support for speaking names to the noqa comments sounds like a good idea. However, my hope is that people will use whitelists more commonly than noqa comments since the latter add noise to the source code. |
The example
vulture mydir --make-whitelist > whitelist.py
in the readme typically creates an invalid Python file since it lacks imports. Such a file would create a problem for multiple other static analyzers that would find it to be grossly invalid Python code. It would be better if this example were updated to to use the extension.txt
instead as below:$ vulture mydir --make-whitelist > vulture.txt $ vulture mydir vulture.txt
The
# Vulture whitelist:
header can be added to the created file. In this way, the Python imports can continue to be missing in this whitelist file, and the other static analyzers won't have any issue with it.I'm actually quite displeased with the current end-user whitelist setup. It doesn't seem well thought through at all. If I use a .py whitelist file with the appropriate imports, then vulture complains that the imports are unused. If I use a .txt whitelist file, then it's not possible to define which file each exclusion is supposed to have been imported from, making it a non-specific exclusion. If for example, I specify "my_foo_pkg.my_sub_pkg.xyzz" in a .txt file, then "my_foo_pkg.my_sub_pkg" are not checked.
The text was updated successfully, but these errors were encountered: