Skip to content

Add pre-commit hooks + enforce formatting in CI - #3

Merged
YheChen merged 1 commit into
masterfrom
chore/pre-commit-hooks
Jul 15, 2026
Merged

Add pre-commit hooks + enforce formatting in CI#3
YheChen merged 1 commit into
masterfrom
chore/pre-commit-hooks

Conversation

@YheChen

@YheChen YheChen commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

Adds git pre-commit hooks so lint/format/hygiene issues are caught locally before they reach CI, and enforces the same formatting standard server-side.

Changes

  • .pre-commit-config.yaml — ruff lint (--fix) + ruff-format, plus pre-commit-hooks hygiene (trailing whitespace, end-of-file, check-yaml, check-toml, merge-conflict, large-file, case-conflict). Revs pinned via pre-commit autoupdate.
  • CI — added a ruff format --check step next to the existing lint step, so formatting is enforced on every push/PR.
  • depspre-commit added to the [dev] extra.
  • Makefilemake hooks runs pre-commit install.
  • README — documents the code-quality workflow.
  • formatting — applied ruff format across the codebase (whitespace-only reformat, no behavioural change).

Usage

make install    # venv + deps
make hooks      # install the git hook

Verification (local, ruff 0.15.21 — matches the pinned hook)

  • pre-commit run --all-files → all hooks pass on a clean second pass
  • ruff check src tests → clean
  • ruff format --check src tests → 71 files already formatted
  • pytest -q → 64 passed

🤖 Generated with Claude Code

Add .pre-commit-config.yaml (ruff lint + ruff-format, plus trailing
whitespace / EOF / YAML / TOML / merge-conflict / large-file hygiene)
so issues are caught before they reach CI. Revs pinned via autoupdate.

- CI: add `ruff format --check` alongside the existing lint step so the
  same standard is enforced server-side
- deps: add pre-commit to the dev extra
- Makefile: add `make hooks` (pre-commit install)
- README: document the code-quality workflow
- apply ruff format across the codebase (whitespace-only reformat)

ruff check, ruff format --check, and the 64-test suite all pass locally
(ruff 0.15.21, matching the pinned hook).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@YheChen
YheChen merged commit 455ed27 into master Jul 15, 2026
2 checks passed
@YheChen
YheChen deleted the chore/pre-commit-hooks branch July 15, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant