-
Notifications
You must be signed in to change notification settings - Fork 148
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
pre-commit hook run only on staged/committed files on current branch? #259
Comments
If Vulture is run on staged/committed files only, it will report false "unused import" results. I'm not sure how pre-commit works under the hood, but I'm wondering if it can be configured to do the following: Run Vulture on all your files, and then grep the results to show only the ones for staged/committed files. |
@RJ722 taking a simple example - assuming 2 files in same directory file a.py file b.py if i run vulture on all files , the unused import for file the unused import for file a.py only happens when i run see below - running on single file gives a unused import , while running vulture on files in the parent folder and grepping for file gives nothing $ vulture --min-confidence=90 dags/locations_nces_to_snowflake.py
dags/locations_nces_to_snowflake.py:10: unused import 'time' (90% confidence)
$ vulture --min-confidence=90 dags/ | grep locations_nces_to_snowflake.py
$
|
Hi, is there an update on this issue? I'm running into the same issue. |
I agree with @RJ722 : it's important to run Vulture on all files. Otherwise, if you edit a file containing name definitions but these names are not used in the file, you'll get many false positives. As @RJ722 says: if it's possible to only report the unused code from changed files, that would be a useful change, though. PRs welcome :-) |
vulture seems like a very useful tool, yet I can't configure it quite right. Perhaps it's a bug - or a configuration issue that could be explained slightly better.
i want to use the vulture pre-commit hook to only run on the staged/committed files in my branch individually and not run it based on directories specified in
paths
under the pyproject.tomlIf i use the
pyproject.toml
config and specify the directories - the unused imported lib in 1 file can be used in another file in the same directory and hence the detection of unused imports does not happenis it possible to only run on staged/committed files individually?
The text was updated successfully, but these errors were encountered: