Skip to content

docs: Enable Ruff formatting of Python code blocks in Markdown - #982

Merged
vdusek merged 2 commits into
masterfrom
chore/enable-ruff-markdown-formatting
Jul 29, 2026
Merged

docs: Enable Ruff formatting of Python code blocks in Markdown#982
vdusek merged 2 commits into
masterfrom
chore/enable-ruff-markdown-formatting

Conversation

@vdusek

@vdusek vdusek commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What & why

Ruff 0.16 formats Python code blocks embedded in Markdown files, and does so by default. In this repo the feature was inert because [tool.ruff] include was an allowlist of *.py globs, so no Markdown file ever reached the formatter. Adding **/*.md and **/*.mdx turns it on, which means docs snippets are now held to the same formatting standard as the rest of the codebase instead of drifting by hand.

MDX needs the explicit extension = { mdx = "markdown" } mapping - without it Ruff would try to parse .mdx as Python and fail. Most of the Python snippets in docs/ live in .mdx, so the mapping is what makes this useful here.

No changes to the lint / format Poe tasks are needed. lint already runs ruff format --check and format already runs ruff format, so both pick Markdown up automatically. Note that ruff check (lint rules) does not support Markdown yet, so only formatting is enforced there.

Notes

  • Code blocks under docs/ are formatted to 90 columns, not 120, because of the existing docs/pyproject.toml override that keeps doc snippets free of a horizontal scrollbar. That is why one line in the upgrading guide got wrapped.
  • The second commit collapses the include allowlist to a single **/*.py glob. This is a pure simplification: no tracked .py file lives outside the previously listed directories, and Ruff processes exactly the same 189 files before and after.

✍️ Drafted by Claude Code

@vdusek
vdusek requested a review from szaganek as a code owner July 29, 2026 13:15
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jul 29, 2026
@vdusek vdusek self-assigned this Jul 29, 2026
@github-actions github-actions Bot added this to the 146th sprint - Tooling team milestone Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.62%. Comparing base (b49fb35) to head (ee18c40).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #982   +/-   ##
=======================================
  Coverage   94.62%   94.62%           
=======================================
  Files          58       58           
  Lines        5248     5248           
=======================================
  Hits         4966     4966           
  Misses        282      282           
Flag Coverage Δ
integration 92.28% <ø> (+0.01%) ⬆️
unit 83.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek changed the title chore: Enable Ruff formatting of Python code blocks in Markdown docs: Enable Ruff formatting of Python code blocks in Markdown Jul 29, 2026
@vdusek
vdusek requested a review from janbuchar July 29, 2026 13:24
@vdusek
vdusek merged commit 5a48589 into master Jul 29, 2026
30 checks passed
@vdusek
vdusek deleted the chore/enable-ruff-markdown-formatting branch July 29, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants