wrolpi/.github/workflows/dead-code.yml
lrnselfreliance f4cd3b6f77
Fail CI when vulture finds new dead code (#889)
* Fail CI when vulture finds new dead code

scripts/check_dead_code.py runs vulture and compares its findings with
scripts/vulture_baseline.txt.  The baseline is keyed by file and name, not
line number, so unrelated edits do not invalidate it.  Class fields,
attributes, test arguments (side-effect fixtures), and alembic revision
names are not reported, because nearly all of them are false positives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* TEMP: add a dead function to prove the Dead Code check fails

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Revert the temporary dead function

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 16:10:52 -06:00

34 lines
1 KiB
YAML

name: Dead Code
# Same triggers as backend.yml: `pull_request` is unfiltered so pull requests into feature branches
# are checked too, not only those into master.
on:
push:
branches: [master, feature/*]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Fails when vulture finds dead code that is not in scripts/vulture_baseline.txt. vulture only
# parses the source, so WROLPi's requirements are not installed.
vulture:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
# Trixie ships 3.13.
python-version: '3.13'
# Pinned: a new vulture release can report findings the baseline does not know about.
- name: Install vulture
run: pip install vulture==2.16
- name: Check for new dead code
run: python scripts/check_dead_code.py