Skip to content

fix: make pre-commit run --all-files pass and stop format drift - #185

Merged
MarTrepodi merged 6 commits into
developfrom
fix/pre-commit-all-files
Oct 13, 2026
Merged

MarTrepodi merged 6 commits into
developfrom
fix/pre-commit-all-files

Conversation

@MarTrepodi

Copy link
Copy Markdown
Collaborator

Summary

uvx pre-commit run --all-files failed on develop in three hooks. This fixes each one and closes the CI gap that let them drift.

  • ruff check (B905): both _compare helpers in parity/scripts/ return early when list lengths differ, so zip(..., strict=True) matches the intended semantics.
  • ruff format: reformats 19 example scripts and the 2 parity scripts. Formatting changes only. Every script still compiles.
  • end-of-file-fixer: adds a final newline to tests/resources/example-player.json and gameData.json. These fixtures are only read through json.loads, so no exclusion is needed. uv run pytest tests/ gives 1526 passed, 30 skipped.
  • CI lint job:
    • Drops continue-on-error: true from the format step. That flag meant formatting drift could never fail CI.
    • Widens the format check to src/ tests/ examples/ parity/.
    • Adds parity/ to ruff check. examples/ stays excluded from linting, as in the pre-commit hook. It has 28 F841/F401/I001 findings, which belong in a separate change.

Notes

Test plan

  • uvx pre-commit run --all-files passes
  • uv run pytest tests/ passes
  • uvx ruff check src/ tests/ parity/ and uvx ruff format --check src/ tests/ examples/ parity/ pass

🤖 Generated with Claude Code

CI used unpinned `uvx ruff` (latest on PyPI), pre-commit pinned
ruff-pre-commit at v0.15.4 (not tracked by Dependabot), and uv.lock
held 0.15.15. Make uv.lock the single source of truth so Dependabot
uv bumps move all three together.

- Add a `lint` dependency group with ruff; `dev` includes it.
- CI lint job: `uv sync --locked --only-group lint`, then
  `uv run --no-sync ruff ...`.
- pre-commit: replace ruff-pre-commit with local `uv run ruff` hooks,
  matching the existing local ty hook.
- Update CONTRIBUTING.md and the PR template to `uv run ruff`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation ci Changes related to continuous integration processes testing labels Oct 13, 2026
MarTrepodi and others added 5 commits October 13, 2026 09:09
Both _compare helpers return early when list lengths differ, so the zip
always sees equal-length inputs. strict=True states that invariant and
satisfies ruff B905. The scripts are also run through ruff format, which
they had drifted from because CI never checked parity/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI only checked formatting under src/ and tests/, so these drifted.
The pre-commit hygiene hooks also fixed trailing whitespace and final
newlines in a few of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixtures are only read through json.loads, so the trailing newline added
by end-of-file-fixer does not change any test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The format step had continue-on-error set, so drift never failed the
build. Everything is formatted now, so drop it and widen the check to
examples/ and parity/. Lint parity/ too; examples/ stays out of lint,
matching the pre-commit ruff hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ruff 0.17 formats Python code blocks inside Markdown, and the format
check now covers examples/, so the Dependabot ruff 0.17.0 bump would fail
Lint on this file. Apply its formatting (PEP 8 blank lines around the
top-level function) now. ruff 0.15 skips Markdown, so this passes on the
currently locked version too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MarTrepodi
MarTrepodi force-pushed the fix/pre-commit-all-files branch from 0814b2e to f7f2b18 Compare October 13, 2026 13:10
@github-actions github-actions Bot added the dependencies Updates to package dependency libraries label Oct 13, 2026
@MarTrepodi
MarTrepodi merged commit 81dfe05 into develop Oct 13, 2026
16 checks passed
@MarTrepodi
MarTrepodi deleted the fix/pre-commit-all-files branch October 13, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes related to continuous integration processes dependencies Updates to package dependency libraries documentation Improvements or additions to documentation testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant