Skip to content

Run ruff via prek local system hooks, on Markdown too - #168

Merged
thibaudcolas merged 1 commit into
mainfrom
prek-ruff-system-hook
Aug 14, 2026
Merged

Run ruff via prek local system hooks, on Markdown too#168
thibaudcolas merged 1 commit into
mainfrom
prek-ruff-system-hook

Conversation

@thibaudcolas

Copy link
Copy Markdown
Member

Summary

  • Replace the pinned astral-sh/ruff-pre-commit mirror repo (rev v0.15.9) with local system-language hooks that call uv run ruff check --fix and uv run ruff format, so prek always uses the same ruff version as uv.lock/CI instead of a separately-pinned mirror revision.
  • ruff-format now runs against Markdown files as well as Python (types_or = ["python", "markdown"]), so drift in fenced Python code blocks in docs (like the one just fixed on Lock file maintenance #154) is caught locally instead of only in CI.

Test plan

  • prek run --all-files passes cleanly
  • Verified ruff-format catches and fixes reformatted Markdown code blocks (tested by intentionally breaking quote style in a doc, confirming the hook flags/fixes it, then reverting)
  • Verified ruff-check still only targets Python files (ruff doesn't lint embedded Markdown code)

Move ruff off the astral-sh/ruff-pre-commit mirror, which pinned its own ruff version separate from the one in uv.lock, and only linted/formatted Python files. Local system hooks always use `uv run ruff`, matching the project's pinned version, and ruff-format now also runs on Markdown files, catching drift like the one just fixed in the lock-file-maintenance PR.
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

🔍 OpenCodeReview found 1 issue(s) in this PR.

  • ✅ Successfully posted inline: 1 comment(s)

Comment thread prek.toml
Comment on lines +42 to +43
language = "system"
types = ["python"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original remote hook was pinned to a specific version (v0.15.9). By switching to a local system hook with language = "system", version pinning is lost. Different environments may have different ruff versions installed, leading to inconsistent behavior. Consider using a versioned tool like uvx ruff@0.15.9 or maintaining a lock file for the development environment.

@thibaudcolas
thibaudcolas merged commit 29cf39c into main Aug 14, 2026
12 checks passed
@thibaudcolas
thibaudcolas deleted the prek-ruff-system-hook branch August 14, 2026 07:42
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