Exclude *.md files from formatting and linting - #2068
Merged
KatieB5 merged 1 commit intoSep 23, 2026
Merged
Conversation
Python embedded in Markdown is now automatically picked up by Ruff. 15c48a3 added a just check workflow in CI. We want this to run for PRs merging into main, but don't want researchers who contribute directly to the documentation to encounter failing checks due to formatting or linting of Python snippets in Markdown. Add `extend-exclude = ["*.md"]` to `pyproject.toml`, as recommended in the Ruff docs (https://docs.astral.sh/ruff/formatter/#markdown-code-formatting). Also remove the `<!-- fmt:off --> / <!-- fmt:on -->` comments introduced in 70ff69a. These were only needed to suppress Ruff's Markdown formatting and are redundant now that Markdown files are excluded. Once this PR is merged, branch protection rules will need to be updated in the docs repo Settings, to enforce the new CI workflow.
Deploying opensafely-docs with
|
| Latest commit: |
b05b307
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://98b149fe.opensafely-docs.pages.dev |
| Branch Preview URL: | https://katieb5-exclude-markdown-fil.opensafely-docs.pages.dev |
KatieB5
marked this pull request as ready for review
September 23, 2026 08:28
tomodwyer
approved these changes
Sep 23, 2026
KatieB5
deleted the
KatieB5/exclude-markdown-files-from-ruff-formatting
branch
September 23, 2026 12:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python embedded in Markdown is now automatically picked up by Ruff. 15c48a3 added a just check workflow in CI. We want this to run for PRs merging into
main, but don't want researchers who contribute directly to the documentation to encounter failing checks due to formatting or linting of Python snippets in Markdown (discussion in Slack thread).This PR excludes
*.mdfiles from Ruff formatting and linting.Local testing
Introduce a formatting error in a
.pyfile, and a python snippet in a.mdfile:Update pyproject.toml to add the exclude-extend setting and exclude markdown files.
Only the
.pyformatting error is picked up.NOTE: Once this PR is merged, branch protection rules will need to be updated in the docs repo Settings, to enforce the new
just checkCI workflow to run for PRs to merge intomain.TO DO: