tests/docs: read an indented code block as code, not prose #104

Open
github-bot wants to merge 1 commit from github-bot/gh-104 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:18 UTC · original
ubiquitarianism:old-pr/9836 → main · +18 −1 · 1 files · 1 commits · draft

Carried over from old PR 9836 by noosko21-a11y in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9836, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
noosko21-a11y: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

tests/test_docs_repeated_lines.py is red on main (f48adad7), and it is the check's own bug:

AssertionError: Lists differ: ['tests/semantic/README.md:5 and :7'] != []

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() already skipped fenced blocks, and its docstring says it flags prose that is "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. Introduced by the merge of #9750.

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, so an indented line is now skipped the way a fenced one already was: four spaces (Markdown's code block) or a tab.

Tested

Clean worktree at main (f48adad7):

python -I tests/test_docs_repeated_lines.py
  main : Ran 2 tests, FAILED
  after: Ran 3 tests, OK

Old detector against new, over every tracked Markdown file, so this does not 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. The test gains the case directly: an indented two-command block is not reported, and a tab-indented one is not either.

Windows 11, Python 3.12.10. No game files, no GPU: Markdown plus one standard-library test.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. - not applicable, no translator change.
**@⁠Andretuta** on GitHub · 2026-11-24 02:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/104) `ubiquitarianism:old-pr/9836` → `main` · +18 −1 · 1 files · 1 commits · draft > Carried over from **old PR 9836** by `noosko21-a11y` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9836`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `noosko21-a11y`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): `tests/test_docs_repeated_lines.py` is red on `main` (`f48adad7`), and it is the check's own bug: ``` AssertionError: Lists differ: ['tests/semantic/README.md:5 and :7'] != [] ``` `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()` already skipped fenced blocks, and its docstring says it flags prose that is "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. Introduced by the merge of `#9750`. 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, so an indented line is now skipped the way a fenced one already was: four spaces (Markdown's code block) or a tab. ### Tested Clean worktree at `main` (`f48adad7`): ``` python -I tests/test_docs_repeated_lines.py main : Ran 2 tests, FAILED after: Ran 3 tests, OK ``` Old detector against new, over every tracked Markdown file, so this does not 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. The test gains the case directly: an indented two-command block is not reported, and a tab-indented one is not either. Windows 11, Python 3.12.10. No game files, no GPU: Markdown plus one standard-library test. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. - not applicable, no translator change.
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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:44:35 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
The changes on this branch are already on the target branch. This will be an empty commit.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/104/head:github-bot/gh-104'
git switch 'github-bot/gh-104'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-104'
git switch 'github-bot/gh-104'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-104'
git switch 'github-bot/gh-104'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-104'
git switch 'main'
git merge --squash 'github-bot/gh-104'
git switch 'main'
git merge --ff-only 'github-bot/gh-104'
git switch 'main'
git merge 'github-bot/gh-104'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.