Skip to content

chore: exclude Markdown from ruff format scope - #2589

Merged
goldmedal merged 1 commit into
Canner:mainfrom
ttw225:worktree-fix+ruff-exclude-markdown
Jul 28, 2026
Merged

chore: exclude Markdown from ruff format scope#2589
goldmedal merged 1 commit into
Canner:mainfrom
ttw225:worktree-fix+ruff-exclude-markdown

Conversation

@ttw225

@ttw225 ttw225 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Root cause

ruff 0.16.0 (2026-07-23) ships a breaking change:

Ruff can now format Python code blocks in Markdown files and will do this by
default.

Our lint jobs declare ruff>=0.4 with no upper bound, so CI adopted 0.16.0 on
its own and .md files entered ruff format's scope for the first time.
wren-langchain CI has been red on main since 2026-07-24.

Bisect in sdk/wren-langchain — the file count alone shows it:

ruff files scanned result
≤ 0.15.0 38 (= exactly the .py count) pass
0.16.0 40 (38 .py + 2 .md) fail

All 38 .py files are clean under 0.16.0. The failure comes entirely from
Markdown.

Why exclude rather than reformat

  • Formatting Markdown buys no correctness. ruff silently skips code blocks
    it cannot parse — a .md holding syntactically invalid Python still reports
    1 file already formatted and exits 0. The check is cosmetic only.
  • Coverage is incoherent. docs/core/sdk/langchain.md and
    docs/core/sdk/pydantic.md share snippets with the SDK READMEs but sit under
    no ruff config, so the same example is enforced in one file and unmanaged in
    the other.
  • It recurs. With no upper bound on ruff and docs in scope, any future
    release can turn CI red on documentation again.
  • The docs are hand-formatted on purpose. These READMEs align inline
    comments across a column of API-to-description pairs. ruff has declined to
    preserve alignment (Formatter: Keep right-hanging comments aligned astral-sh/ruff#7684, open since 2023; formatter: add config option to preserve leading whitespace before inline comments astral-sh/ruff#23578
    closed unmerged) — a fair call for code, a poor fit for a hand-tuned doc table.

extend-exclude = ["*.md"] is the opt-out Astral documents for this.

What

Added to every package carrying a ruff config:

  • sdk/wren-langchain — fixes the red CI
  • sdk/wren-pydantic — latent; its CI has not run since before the release
  • core/wren — passing, but its lint runs uvx ruff (always newest)
  • core/wren-core-py — no-op while pinned at 0.13.1

No documentation content is changed.

Test plan

Each package's own CI commands under ruff 0.16.0, plus 0.15.0 to confirm the
setting is inert on older versions — all pass: wren-langchain 38 files,
wren-pydantic 34, core/wren 69 (src/), wren-core-py 3.

Pre-existing and untouched: core/wren-core-py has an I001 in
tests/test_cube.py on main, identical with and without this change.


Separately: pinning ruff would not help core/wren — its lint calls uvx ruff,
which resolves independently of the project's dev dependencies. Happy to open an
issue if worth pursuing.

Summary by CodeRabbit

  • Chores
    • Updated code-quality tooling configuration to exclude Markdown files from automated Ruff processing.
    • Added documentation clarifying Markdown formatting behavior in newer Ruff versions.

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code core labels Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Ruff configurations in four Python projects now exclude Markdown files and document Ruff’s Markdown formatting behavior.

Changes

Ruff Markdown exclusion

Layer / File(s) Summary
Configure Markdown exclusion
core/wren-core-py/pyproject.toml, core/wren/pyproject.toml, sdk/wren-langchain/pyproject.toml, sdk/wren-pydantic/pyproject.toml
Ruff configurations add *.md to extend-exclude; comments explain the Markdown formatting behavior and hand-formatted documentation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: paulchen79

Poem

A rabbit hops through docs so neat,
While Ruff skips Markdown at its feet.
Four configs softly close the gate,
Hand-formatted pages keep their state.
Hop, hop—formatting feels complete!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: excluding Markdown files from Ruff formatting scope.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@goldmedal
goldmedal merged commit 094d84d into Canner:main Jul 28, 2026
22 checks passed
@ttw225
ttw225 deleted the worktree-fix+ruff-exclude-markdown branch July 29, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core dependencies Pull requests that update a dependency file python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants