Honour [tool.vulture] in pyproject.toml - #838
Closed
Eljees wants to merge 1 commit into
Closed
Conversation
Vulture reads that section itself, so a project that sets ignore_decorators or ignore_names got one answer from `vulture` and a different one from `prospector`: the tool was constructed with neither, and the settings were never read at all. Read them with vulture's own loader, so the two agree on what the section means, and pass them through. min_confidence and exclude are left alone -- prospector does its own file finding and message filtering, and applying them here would mean deciding how they compose with that. Fixes prospector-dev#505
Contributor
Author
|
Duplicate of #836, which is already under review — my mistake, closing this one. The fixture-based test from here is the better of the two, so I've moved it over to #836 in 8f73150. The implementation to keep is the one in #836: it honours |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #505.
VultureToolnever read[tool.vulture], andProspectorVulture.__init__calledVulture.__init__(self, verbose=False)— dropping the two keyword arguments vulture accepts for exactly this,ignore_namesandignore_decorators. So the same project answered differently depending on which command ran.With the reporter's setup —
ignore_decorators = ["@app.get", "@app.post"],ignore_names = ["keep_me"], and a file holding two decorated routes,keep_me, and one genuinely dead function:The two now agree.
The section is read with vulture's own
make_config, rather than a hand-rolled TOML read, so the two can't drift on what a key means. Theargvit's given is only there to satisfy vulture's argument parser, which insists on a path; the paths it produces are discarded, since prospector has already found the files. A missing or malformedpyproject.tomlyields no settings rather than an error — prospector runs in plenty of projects that have neither.Deliberately not included:
min_confidenceandexclude. Both are in the same section, but prospector does its own file finding and its own message filtering, so honouring them here means deciding how they compose withignore-pathsand with the profile'sdisablelist — a bigger question than this issue asks. Say the word if you'd like them in and I'll add them.test_vulture_reads_pyproject_configruns the tool against a fixture project carrying that config; it fails on currentmasterwithread_items should have been ignoredand passes with the change.ruff formatandruff checkare clean under the repo's own configuration. The wider suite has four collection errors from optional tools that aren't installed here — the same four, on the clean tree and with this branch.The thread also mentions
pydocstylehaving the same shape of problem; that's a separate tool wrapper and I've left it alone.AI-assisted (LLM used for drafting); the runs above are mine.