From a5d69eb37d5a6c1d787b2bab39e572e75ad75c44 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sun, 15 Nov 2026 12:43:57 -0500 Subject: [PATCH] ci(lint): enforce ruff format --check in pre-commit hook and flake check - .githooks/pre-commit: add ruff format --check . alongside ruff check, pyright, and pytest - flake.nix: add ruff format --check . to packages.default preCheck - AGENTS.md: update Section 5 verification rules to include ruff format --check --- .githooks/pre-commit | 3 ++- AGENTS.md | 4 ++-- flake.nix | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 5d03393..df299d5 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -3,8 +3,9 @@ set -euo pipefail if command -v ruff >/dev/null 2>&1 && command -v pyright >/dev/null 2>&1 && command -v pytest >/dev/null 2>&1; then ruff check . + ruff format --check . pyright pytest else - nix develop --command bash -c "ruff check . && pyright && pytest" + nix develop --command bash -c "ruff check . && ruff format --check . && pyright && pytest" fi diff --git a/AGENTS.md b/AGENTS.md index 0731395..cf85333 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -45,7 +45,7 @@ The working tree represents the user's active work. ## 5. Verification, Hooks & CI Expectations Every task and commit must pass automated verification inside `nix develop`: -1. **Local Pre-Commit Hook (`.githooks/pre-commit`):** Configured automatically by `flake.nix` `shellHook` (`git config core.hooksPath .githooks`). Runs `ruff check .`, `pyright`, and `pytest` before every commit. Never bypass hooks with `--no-verify`. +1. **Local Pre-Commit Hook (`.githooks/pre-commit`):** Configured automatically by `flake.nix` `shellHook` (`git config core.hooksPath .githooks`). Runs `ruff check .`, `ruff format --check .`, `pyright`, and `pytest` before every commit. Never bypass hooks with `--no-verify`. 2. **TDD Red-Phase Commits (`@pytest.mark.xfail`):** When committing Red-phase tests before the feature implementation exists, provide typed symbol stubs (`raise NotImplementedError`) so `pyright` passes, and decorate unimplemented tests with `@pytest.mark.xfail(strict=True, reason="Red phase: ...")` so `pytest` and `.githooks/pre-commit` exit `0` while still failing if a Red test passes tautologically. Remove `xfail` in the Green-phase commit. -3. **Server-Side Gitea Actions CI (`.gitea/workflows/ci.yaml`):** Runs `nix flake check` on every push and pull request targeting `main`, executing `ruff check .`, `pyright`, `pytestCheckHook`, and `buildPythonApplication` inside the isolated Nix sandbox. Verify `nix flake check` locally before opening or updating a pull request. +3. **Server-Side Gitea Actions CI (`.gitea/workflows/ci.yaml`):** Runs `nix flake check` on every push and pull request targeting `main`, executing `ruff check .`, `ruff format --check .`, `pyright`, `pytestCheckHook`, and `buildPythonApplication` inside the isolated Nix sandbox. Verify `nix flake check` locally before opening or updating a pull request. 4. **Completion Reporting:** Report: (1) What changed, (2) Files modified/created, (3) Verification performed, (4) Unverified areas/risks. diff --git a/flake.nix b/flake.nix index c612763..345258b 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,7 @@ ] ++ testDeps; preCheck = '' ruff check . + ruff format --check . pyright ''; };