chore: add vulture dead-code detection and remove findings - #915
Merged
Conversation
Add vulture as a lint dependency, a `just deadcode` recipe, and a vulture_whitelist.py that names each indirectly-used symbol explicitly (framework dispatch, serialization, interpreter protocols) instead of relying on wide glob ignores. Exclude the whitelist from ruff and ty since it is data for vulture, not executable code.
Remove symbols that `just deadcode` reported and that were confirmed unused: - a write-only last-RPC timestamp on the gossipsub peer state - a mock response-stream flag that was set but never asserted - an unused parametrize column in the merkleization tests - an uncalled mock outbound-stream method - two uncalled test helpers (a key-file stub writer and an interop finalization waiter)
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 vulture for dead-code detection, then removes the dead code it found. Split into two commits so the tooling and the removals can be reviewed independently.
Commit 1 — add vulture dead-code detection
vultureto thelintdependency group and ajust deadcoderecipe.pyproject.tomlto scansrc,packages,tests, and the whitelist together (most spec code is exercised only through the test suite, so the tests must be in scope or every test-only-used symbol reads as a false positive).vulture_whitelist.pythat names each indirectly-used symbol explicitly (framework dispatch, serialization, interpreter protocols) instead of relying on wide glob ignores. Excluded from ruff and ty since it is data, not executable code.just deadcodeis intentionally not wired intojust check: vulture has unavoidable false positives on a Pydantic-heavy codebase, so gating CI on it would be noisy.Commit 2 — remove dead code flagged by vulture
Removes the six symbols
just deadcodereported and that were confirmed unused:Three reported symbols were kept as confirmed false positives and recorded in the whitelist instead of removed:
subscribed— essential event field, compared via dataclass equality in testsREAL— constructed viaCryptoMode("real")from the--cryptoCLI optionMESSAGE_LENGTH— documented XMSS protocol parameterVerification
just deadcode→ clean (exit 0)just check→ passes (lint, format, ty, codespell, mdformat, lock)Notes
Draft: the whitelist makes ignores explicit, which means a newly-added Pydantic validator/serializer or fixture will trip vulture until added to
vulture_whitelist.py. That is the intended trade-off for tight, greppable ignores.