tests/docs: read an indented code block as code, not prose (OLD-9836) #1781
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1781
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1781/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Ch1mpleo on GitHub · 2026-11-25 12:02 UTC · original
Ch1mpleo:carry/old-9836→main· +18 −1 · 1 files · 1 commits · merged 2026-11-25 21:24 UTCClaimed in the coordination issue as: OLD-9836 (#1608)
What and why
Carries forward old-pr/9836 (draft #104, keeping
oosko21-a11y's original commit rebased onto current main). Fixes ests/test_docs_repeated_lines.py::repeated_lines to treat 4-space and tab-indented Markdown code blocks as code rather than prose, and adds est_checker_ignores_indented_code_blocks.
Tested
GPUs tested: n/a (CPU-only standard-library unit test)
AI-assisted: yes
Checklist
eeds rebase).
tests/semantic/README.md shows two commands in an indented code block (four spaces, no fence) whose first forty characters are identical: python -I scripts/run_semantic_tests.py tests/semantic python -I scripts/run_semantic_tests.py tests/semantic -j 4 -p 'test_image_*.py' repeated_lines() skips fenced blocks and said so in its own docstring ("neither a list item, table row, heading or code"), but it only recognised the fenced kind, so the two command lines were compared as prose and the check went red on main: AssertionError: Lists differ: ['tests/semantic/README.md:5 and :7'] != [] The same-merge habit is what this file exists to catch, so the report was worth a look, but a command block is not a sentence kept twice and editing the README to dodge the check would leave the next indented block to trip it again. An indented line is now skipped the way a fenced one already was: four spaces (Markdown's code block) or a tab. Measured over every tracked Markdown file, old check against new, so this does not quietly buy green by hiding duplicates: files scanned 104 lines scanned 37,350 lines indented 4+ 1,375 reported by both 0 reported by old only 1 tests/semantic/README.md:5:7 (the false positive) reported by new only 0 The one report the fix removes is the one that was wrong. No real duplicate was lost. The test gains the case directly: an indented two-command block is not reported, and a tab-indented one is not either. python -I tests/test_docs_repeated_lines.py -> Ran 3 tests, OK (main: Ran 2, FAILED at tests/semantic/README.md:5)@PierreEbele on GitHub · 2026-11-25 19:00 UTC · original
Reviewed
41639e899: ranpython -I tests/test_docs_repeated_lines.pyon main (Ran 2 tests, OK) and on the PR (Ran 3 tests, OK), and a probe comparing the old and new checker over all tracked .md files (both report zero today). The motivating failure is already historical: #10002 fenced that README block on 24 Nov, before this PR's base, so main is green and no indented code block remains in the docs. The new rule also skips 4-space list continuations, which CommonMark reads as prose, not code (reproduced: old reports (2,4), new skips it); no live duplicate is hidden today. The new test pins the fix (it fails under main's checker). Sound as written; the direction (checker vs fenced doc) and the list-continuation exemption need the maintainer's call.AI-assisted review.
Recommendation: Needs discussion
@MSedgeMC on GitHub · 2026-11-25 19:03 UTC · original · approved these changes
Verified on the PR branch (clean, 1 commit ahead of main): python3 -m unittest tests.test_docs_repeated_lines -v -> 3 tests OK, including the new indented/tabbed code-block case and the full docs corpus check. The fix correctly treats Markdown indented code blocks like fenced ones in the repeated-lines docs test, removing false positives while keeping the prose check intact. Python-only, no game data.