Repository navigation
fix(archive): match reference-link definitions on every line - #10
Merged
Merged
Conversation
The refactor into archive_checks.py dropped re.MULTILINE from REFERENCE_LINK, so a reference definition such as '[appendix]: missing.md' below the first line stopped being checked while the docs and the module docstring still promised reference-style links were covered. Restore the flag and the pre-refactor semantics, and cover both directions with regression tests (an unresolved definition below a heading, and a resolving one).
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.
Regression
The gate refactor in #9 moved the checks into
archive_checks.pyand droppedre.MULTILINEfromREFERENCE_LINK. Reference definitions after the first line were silently skipped:# title\n\n[ref]: missing.md\n\n[ref]\nmatched nothing (flags: re.NOFLAG,findall → []), whiledocs/RUN_GUIDE.mdand the module's own docstring still promised reference-style links were checked.Fix
REFERENCE_LINK = re.compile(r"^\[[^\]]+\]:\s*(\S+)", re.MULTILINE)— byte-identical pattern and flags to the pre-refactor implementation (git show a05864a:.github/scripts/check_archive.py, compared programmatically:identical pattern+flags: True). The other three patterns were already identical.Tests (both directions)
test_reference_definition_below_first_line_is_checked— a definition below a heading that points atmissing.mdmust producemissing link target. Confirmed red before the fix:AssertionError: 0 != 1.test_resolving_reference_definition_passes— a definition that resolves must not produce a false positive with the restored flag.test_non_markdown_files_are_skippedalready asserted reference definitions are scanned, but only at line 1, which is why the missing flag passed the suite.Verification
The full repository passes the restored flag, so no reference definition in the tree was previously broken and hidden by the regression.