Add vulture dead-code analyzer to CI and pre-commit#2075
Draft
frenckatron wants to merge 1 commit into
Draft
Conversation
Adds a vulture (min-confidence 80) job to the linting workflow and a matching pre-commit hook, scoped to src/wled and tests via [tool.vulture] in pyproject.toml. Ruff already enforces F401/F841 through its existing `select = ["ALL"]` configuration, so no additional ruff job is needed. Also drops the unnecessary string-form annotation around SerializableData in tests/conftest.py — the import is now visibly used at runtime, which keeps the new vulture baseline clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What
Adds a vulture dead-code analyzer job to the linting workflow and a matching pre-commit hook, with min-confidence 80 scoped to
src/wledandtests.Why
To keep the codebase at its current clean baseline as new features land — catching unused imports, variables, functions, and classes before they accumulate. Ruff already enforces
F401/F841through its existingselect = ["ALL"]config, so the new check focuses on what ruff can't see (unused classes, methods, attributes).How
vulture = "2.16"added to the dev dependency group inpyproject.toml(lockfile regenerated).[tool.vulture]section pinspaths = ["src/wled", "tests"]andmin_confidence = 80sovultureruns identically in CI, pre-commit, and locally.vulturejob in.github/workflows/linting.yamlmirrors the existing pattern (Poetry + cached Python +poetry run vulture).vulturehook in.pre-commit-config.yamlwithpass_filenames: falseso the whole tree is analyzed every run (vulture needs full module context to avoid false positives).tests/conftest.py:SerializableDatawas imported but only referenced through string-form annotations (data: "SerializableData"), which vulture cannot see. Dropped the quotes so the import is a visible runtime reference.Testing
poetry run vulture→ no findings.poetry run ruff check --select F401,F841 src/wled tests→ All checks passed.poetry run ruff check ./ruff format --check .→ clean.poetry run pytest→ 222 passed, 99.17% coverage, 37 snapshots passed.poetry run yamllint/zizmor/pylint/ty check→ unchanged from main.Quality Report
Changes: 5 files changed, 54 insertions(+), 5 deletions(-)
Code scan: clean
Tests: failed (command not found)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline