Skip to content
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

How to ignore all test_*.py files? #260

Closed
srossross opened this issue Jun 2, 2021 · 8 comments
Closed

How to ignore all test_*.py files? #260

srossross opened this issue Jun 2, 2021 · 8 comments

Comments

@srossross
Copy link

The exclude argument does not appear to work the way I was expecting

vulture plantiga_analytics/ --exclude 'test_*.py'

plantiga_analytics/test_compute_main.py:290: unused attribute 'return_value' (60% confidence)
plantiga_analytics/test_compute_main.py:292: unused attribute 'side_effect' (60% confidence)
plantiga_analytics/test_compute_main.py:294: unused attribute 'return_value' (60% confidence)
@noorul
Copy link

noorul commented Jul 17, 2021

Maybe you need '*test_*.py

@RJ722
Copy link
Contributor

RJ722 commented Jul 17, 2021

@noorul is correct. You can also use something like **/*/test_*.py.

@Cheaterman
Copy link

Cheaterman commented Dec 14, 2022

Thanks, this was helpful :-) but I personally don't quite understand why in my situation I need vulture '--exclude=*env/**' . for my venv situated at ./env - I tried --exclude=env/**, ./env/**, /env/**, nothing seems to work :-)

@jendrikseipp
Copy link
Owner

Thanks for the report! The --exclude patterns are matched against absolute paths. I clarified this in the help output and the README now.

@sliedes
Copy link

sliedes commented Sep 18, 2023

Thanks for the report! The --exclude patterns are matched against absolute paths. I clarified this in the help output and the README now.

I'm curious about the rationale for this design decision. It seems rather counterintuitive and error-prone to me; it may lead to things like people with different usernames (and thus different home directories) getting different warnings unless the globs are carefully crafted.

@jendrikseipp
Copy link
Owner

@sliedes Can you provide a concrete problematic example for this, please? Which behaviour would you expect for --exclude?

@sliedes
Copy link

sliedes commented Sep 25, 2023

It just feels very surprising to me; normally, in my experience projects are developed so that you have some "project directory", perhaps a checked out repository, and you'd in my view want the checks to run deterministically inside it regardless of its location in the filesystem.

I have not encountered any pathological examples in practice (well, I only started looking into vulture last week), but I could imagine patterns written with less care like (borrowing from the discussion above) --exclude **/env/*, where everything gets excluded for the poor new intern whose username happens to be "env" and home directory /home/env.

It just seems like a needless pitfall to me. :)

@jendrikseipp
Copy link
Owner

Thanks for the explanation! I hope that #310 will improve the situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants