From fd50d044360d9f49a72ae746f820ae2474163f16 Mon Sep 17 00:00:00 2001 From: hudsonaikins-crown Date: Mon, 28 Sep 2026 22:10:54 -0400 Subject: [PATCH] Add Vulture check and remove unused argument --- .github/workflows/dead-code.yml | 17 +++++++++++++++++ AGENTS.md | 6 ++++++ neural/data_collection/espn_enhanced.py | 6 ++---- quality/vulture-whitelist.py | 5 +++++ scripts/check-dead-code.sh | 7 +++++++ 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/dead-code.yml create mode 100644 AGENTS.md create mode 100644 quality/vulture-whitelist.py create mode 100755 scripts/check-dead-code.sh diff --git a/.github/workflows/dead-code.yml b/.github/workflows/dead-code.yml new file mode 100644 index 00000000..1741daf5 --- /dev/null +++ b/.github/workflows/dead-code.yml @@ -0,0 +1,17 @@ +name: Dead code +# Managed by CodexSkills bootstrap-code-quality.py +on: + pull_request: +permissions: + contents: read +jobs: + dead-code: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: astral-sh/setup-uv@v7 + - run: bash scripts/check-dead-code.sh + env: + QUALITY_BASE_REF: origin/${{ github.base_ref }} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..52c120ca --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,6 @@ + + +## Code cleanup + +- Run `bash scripts/check-dead-code.sh` after removing code and before review. +- For cross-file changes, run `graphify update .`, inspect callers and dependencies, and verify findings in current source and framework registrations. diff --git a/neural/data_collection/espn_enhanced.py b/neural/data_collection/espn_enhanced.py index 612401d9..88da3acb 100644 --- a/neural/data_collection/espn_enhanced.py +++ b/neural/data_collection/espn_enhanced.py @@ -243,9 +243,7 @@ def _calculate_momentum_score(self, play: dict[str, Any]) -> tuple[float, Moment return final_score, direction - def _process_play( - self, play: dict[str, Any], drive_info: dict[str, Any] | None = None - ) -> PlayData: + def _process_play(self, play: dict[str, Any]) -> PlayData: """Process raw play data into structured format.""" play_id = play.get("id", str(play.get("sequenceNumber", 0))) description = play.get("text", "") @@ -364,7 +362,7 @@ async def collect(self) -> AsyncGenerator[dict[str, Any], None]: # Only process new plays if self.last_play_id is None or play_id != self.last_play_id: - processed_play = self._process_play(play, drive) + processed_play = self._process_play(play) new_plays.append(processed_play) all_plays.append(processed_play) diff --git a/quality/vulture-whitelist.py b/quality/vulture-whitelist.py new file mode 100644 index 00000000..0d9963b7 --- /dev/null +++ b/quality/vulture-whitelist.py @@ -0,0 +1,5 @@ +"""Vulture whitelist for callback arguments required by external protocols.""" + +def _required_callback_parameters(signum, exc_type, exc_val, exc_tb, tb): + """Keep names required by signal and context-manager protocols.""" + return signum, exc_type, exc_val, exc_tb, tb diff --git a/scripts/check-dead-code.sh b/scripts/check-dead-code.sh new file mode 100755 index 00000000..ddf5660d --- /dev/null +++ b/scripts/check-dead-code.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Managed by CodexSkills bootstrap-code-quality.py +set -euo pipefail +cd "$(dirname "$0")/.." +py_files=() +while IFS= read -r -d '' file; do py_files+=("$file"); done < <(git ls-files --cached --others --exclude-standard -z -- '*.py') +if ((${#py_files[@]})); then uvx --from vulture==2.16 vulture "${py_files[@]}" --min-confidence 90; fi