Skip to content

Add vulture dead-code analyzer to CI and pre-commit#2075

Draft
frenckatron wants to merge 1 commit into
mainfrom
frenckatron/static-analysis-ci
Draft

Add vulture dead-code analyzer to CI and pre-commit#2075
frenckatron wants to merge 1 commit into
mainfrom
frenckatron/static-analysis-ci

Conversation

@frenckatron
Copy link
Copy Markdown
Collaborator

@frenckatron frenckatron commented May 20, 2026

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/wled and tests.

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 / F841 through its existing select = ["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 in pyproject.toml (lockfile regenerated).
  • [tool.vulture] section pins paths = ["src/wled", "tests"] and min_confidence = 80 so vulture runs identically in CI, pre-commit, and locally.
  • New vulture job in .github/workflows/linting.yaml mirrors the existing pattern (Poetry + cached Python + poetry run vulture).
  • New vulture hook in .pre-commit-config.yaml with pass_filenames: false so the whole tree is analyzed every run (vulture needs full module context to avoid false positives).
  • Cleaned up the one pre-existing finding in tests/conftest.py: SerializableData was 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

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a88cb9ce-313e-47d8-986c-6a2cdddae329

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch frenckatron/static-analysis-ci

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@frenck frenck added the ci Work that improves the continue integration. label May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Work that improves the continue integration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants