Fix reference definition labels for backtick-quoted shortcut links#16035
Fix reference definition labels for backtick-quoted shortcut links#16035MichaReiser merged 4 commits intoastral-sh:mainfrom
Conversation
|
That Mkdocs recognizes links like I think that's all of them. More importantly, there should be a test somewhere so that such a link can't possibly be accidentally introduced again. Where would I even put that? |
|
That's where all of the other custom docs checks appear to happen. Although the main purpose appears to be ensuring that the examples are formatted correctly, there are a couple of unrelated checks as well, like ensuring the required sections for rule docs are present. |
|
Section headers and code blocks are easy to check for, but inline links aren't. I imagine that would take quite some manual parsing/regexes on top of a list of every option known to Ruff. |
|
Would you mind updating your test plan and showing the rendered documentation for a page before/after your change (doesn't have to be for all of them, just pick one ;)) |
MichaReiser
left a comment
There was a problem hiding this comment.
It would be great if we'd have some linting or at least, guidance in the contribution guidelines. I otherwise worry, that we'll introduce incompatible links in the future. But that's something we can do separately.
Thank you!
* main: (991 commits) [red-knot] Resolve `Options` to `Settings` (#16000) Bump version to 0.9.6 (#16074) Revert tailwindcss v4 update (#16075) Improve migration document (#16072) Fix reference definition labels for backtick-quoted shortcut links (#16035) RUF009 should behave similar to B008 and ignore attributes with immutable types (#16048) [`pylint`] Also report when the object isn't a literal (`PLE1310`) (#15985) Update Rust crate rustc-hash to v2.1.1 (#16060) Root exclusions in the server to project root (#16043) Directly include `Settings` struct for the server (#16042) Update Rust crate clap to v4.5.28 (#16059) Update Rust crate strum_macros to 0.27.0 (#16065) Update NPM Development dependencies (#16067) Update Rust crate uuid to v1.13.1 (#16066) Update Rust crate strum to 0.27.0 (#16064) Update pre-commit dependencies (#16063) Update dependency ruff to v0.9.5 (#16062) Update Rust crate toml to v0.8.20 (#16061) [`flake8-builtins`] Make strict module name comparison optional (`A005`) (#15951) [`ruff`] Indented form feeds (`RUF054`) (#16049) ...
## Summary Follow-up to #16035. `check_docs_formatted.py` will now report backtick-quoted shortcut links in rule documentation. It uses a regular expression to find them. Such a link: * Starts with `[`, followed by <code>\`</code>, then a "name" sequence of at least one non-backtick non-newline character, followed by another <code>\`</code>, then ends with `]`. * Is not followed by either a `[` or a `(`. * Is not placed within a code block. If the name is a known Ruff option name, that link is not considered a violation. ## Test Plan Manual.
Summary
Resolves #16010.
The changes boil down to something like this:
Test Plan
Mkdocs:
GitHub:
CommonMark dingus: