From 806c03be98dac8cfd7bee443f28ec09fd40bab5d Mon Sep 17 00:00:00 2001 From: Christian Boos Date: Fri, 9 Oct 2026 12:38:33 +0200 Subject: [PATCH] Gate formatting in ci; ignore the oxfmt reformat in git blame `just fmt-check` joins `just ci`, and CI runs the same two checks on the primary job, after lint-js; both run, so every unformatted file is listed. `.git-blame-ignore-revs` names the reformat commit (#357), and CONTRIBUTING says how to point `git blame` at it. Co-Authored-By: Claude Opus 5.5 --- .git-blame-ignore-revs | 2 ++ .github/workflows/ci.yml | 9 +++++++++ CONTRIBUTING.md | 11 +++++++++++ justfile | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..f70f33e7 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Reformat JS, CSS, JSON and YAML with oxfmt (#357) +8ae38e5ba6b5339fbd25f64dd22ce85a1e91cec7 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b495635c..7feca7c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,3 +119,12 @@ jobs: - name: Lint the templates' JavaScript (primary only) if: matrix.is-primary run: uv run --group js python scripts/lint_js.py + + - name: Check JS, CSS, JSON and YAML formatting (primary only) + if: matrix.is-primary + # Both checks run, so every file that needs formatting is listed + run: | + status=0 + uv run --group js oxfmt --check || status=1 + uv run --group js python scripts/fmt_templates.py --check || status=1 + exit $status diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 51557172..c2fc0663 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -290,6 +290,17 @@ back verbatim. Each construct must sit on lines of its own; the script refuses anything else. Such files are found by their content, but they must also be listed in `ignorePatterns`, which a unit test checks. +`just fmt-check` is part of `just ci`, and CI runs it once (on the primary +job), so a change that isn't formatted fails; run `just fmt-js` before +committing. The commit that first formatted the tree is listed in +`.git-blame-ignore-revs`; to have `git blame` look past it, run once: + +```bash +git config blame.ignoreRevsFile .git-blame-ignore-revs +``` + +GitHub's blame view reads the file by itself. + When upgrading oxfmt, look at what a run *covers* as well as whether it passes: a release can start formatting a new language (Markdown arrived after 0.69), and then a bare run rewrites files nobody chose to format. diff --git a/justfile b/justfile index e21d760e..736c59aa 100644 --- a/justfile +++ b/justfile @@ -109,7 +109,7 @@ fmt-check: exit $status # Fail-fast order: format and lint take seconds, ty is faster than pyright, the full test suite runs last -ci: format lint lint-js ty typecheck test-all +ci: format lint lint-js fmt-check ty typecheck test-all # Regenerate the auto-generated TUI docs assets (screenshots) into docs/assets/tui docs-gen: