Skip to content

Commit 90ce00f

Browse files
asg017claude
andcommitted
Keep the ruff formatter out of Markdown
ruff 0.16 began formatting Python code blocks inside .md files. That makes `uv run ruff format --check` want to rewrite README's samples, so `just format-check` fails on README.md with "1 file would be reformatted, 38 files already formatted" while every actual .py file is clean. This has to be settled before CI runs format-check, which the next PR adds. The reformat is not an improvement. README aligns trailing comments so a block of schedule examples reads as a column, and ruff flattens each to a single space. Several samples are deliberately partial. Documentation prose and its snippets are a human's call, not the formatter's, and PR 12 owns the README anyway -- one of the hunks ruff wants is the `scheduler.update_task` sample that PR 3 deletes outright, so formatting it now is churn with a short life. Excluding Markdown is also stable, where reformatting is not: it holds across future ruff releases instead of re-churning README whenever the embedded-code formatter changes. Scoped to [tool.ruff.format] rather than a global exclude, so linting is unaffected. (This repo only ever runs `ruff format`; `ruff check` is not wired into any recipe.) Why this was invisible until now: uv.lock is git-ignored and pyproject only floors ruff at >=0.15.0. A fresh resolve -- CI, or any new checkout -- gets 0.16.x, while an older cached environment stays on 0.15.x, which never looked at .md at all. I had 0.15.8 locally and reported format-check green; three worktrees with fresh venvs all resolved 0.16.8 and disagreed. Verified this fix against 0.16.8, not the stale environment. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 7667e0e commit 90ce00f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎pyproject.toml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,16 @@ include = ["datasette_cron*"]
6666

6767
[tool.ty.src]
6868
exclude = ["tests/", "samples/", "frontend/"]
69+
70+
# Keep the formatter out of Markdown. ruff 0.16 began formatting Python code
71+
# blocks inside .md, which rewrites README's samples: aligned trailing comments
72+
# get flattened to a single space, so `"0 8 * * *" # every morning at 8` loses
73+
# the column that makes a block of them readable. The samples are documentation
74+
# -- some are deliberately partial -- and a formatter should not own them.
75+
#
76+
# uv.lock is git-ignored and pyproject only floors ruff, so a fresh resolve (CI,
77+
# or any new checkout) picks up 0.16.x while older cached environments stay on
78+
# 0.15.x and never look at .md at all. Without this, `just format-check` passes
79+
# locally and fails in CI.
80+
[tool.ruff.format]
81+
exclude = ["*.md"]

0 commit comments

Comments
 (0)