From d6096e60d4e82c51289fa3b4eed82aab86489374 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Sun, 6 Sep 2026 13:54:56 -0400 Subject: [PATCH] Level pre-commit's ruff with the one this project declares They had drifted two minor versions apart: the hook pinned v0.14.9 while the dev dependency is 0.16.6. A hook running an older linter than the project's own reports findings `uv run ruff` does not, and the symptom was `make check` failing on `scripts/sync_js_artifacts.py`, a file nobody had touched, for S310 on a URL whose scheme is a literal on the line above the call. Newer ruff reads that correctly; the older one could not. `ruff-format` is held to Python. From v0.15 it also formats Python inside Markdown fences, and letting the bump enable that would rewrite 46 published pages: it collapses the aligned trailing comments the examples use to explain themselves and rewraps calls that were wrapped for reading. Whether the site's examples should be machine-formatted is an editorial decision about the documentation, and not one a version bump should make on the way past. --- .pre-commit-config.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 383ab77..84d42e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,8 +29,20 @@ repos: exclude: ^(docs/typedoc/|docs/snippets/js/|docs/weather/browse/) - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.14.9" + # Kept level with the ruff this project declares as a dev dependency. They drifted two minor + # versions apart, and a hook running an older linter than the project's own reports findings + # `uv run ruff` does not: v0.14.9 flagged S310 on `scripts/sync_js_artifacts.py`, where the URL + # scheme is a literal on the line above the call, and newer ruff reads that correctly. The + # symptom was `make check` failing on a file nobody had touched. + rev: "v0.16.6" hooks: - id: ruff-check args: [ --exit-non-zero-on-fix ] - id: ruff-format + # Python only, which is what this hook formatted before the bump. From v0.15 ruff-format + # also formats Python inside Markdown fences, and turning that on here would rewrite 46 + # published pages: it collapses the aligned trailing comments the examples use to explain + # themselves, and rewraps calls that were wrapped for reading. Whether the site's examples + # should be machine-formatted is an editorial decision about the documentation, and it is + # not one a version bump should make silently. + types_or: [python, pyi]