Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/docproof/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,24 @@
# document in the whole corpus and the other two matched none, which is not evidence; and
# `TOMBSTONE` already draws the line that deprecated is not removed.
HISTORICAL = re.compile(
rf"(?ix) (^|/) (?: {_HISTORICAL_NAMES} ) (?: \.[a-z0-9]+ )? (?: / | $ )"
# THE VERSION SUFFIX, which is this rule failing to recognise its own convention rather
# than a new class of document. `release[-_ ]?notes` has been on the list above since the
# fastapi measurement, and it matched `release-notes.md` while walking straight past
# `docs/release_notes_v7.9.0.md` - because after the name it demanded an extension or a
# slash, and a version number is neither.
#
# `enarjord/passivbot`, batch 10. Two of its five findings are `release_notes_v7.9.0.md`
# naming `configs/examples/default_trailing_grid_long_npos10.json` and
# `release_notes_v7.10.0.md` naming another config, both deleted in later releases. Both
# documents are correct: the config existed at the version the file is named for. Pillow
# gets this for free because its notes live in a `releasenotes/` DIRECTORY; a project that
# keeps them flat and stamps the version on the filename got judged for the same content.
#
# Measured over every sweep batch, 147 finding lines: this suppresses exactly those two
# and nothing else. Deliberately tight - the version must follow immediately, so
# `changelog-policy.md` stays judged, and so does anything whose suffix is a word.
rf"(?ix) (^|/) (?: {_HISTORICAL_NAMES} )"
rf" (?: [-_ ] v? \d+ (?: \.\d+ )* )? (?: \.[a-z0-9]+ )? (?: / | $ )"
rf" | (^|/) changelog\.d/ "
rf" | (^|/) archived? / "
# A FILE called archive, not only a directory. This rule already believes the word means
Expand Down
35 changes: 35 additions & 0 deletions tests/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,3 +848,38 @@ def test_a_plain_deletion_still_reads_as_a_deletion(make_repo: Callable[..., Pat
assert verdict is Verdict.BROKEN
assert "deleted in" in detail
assert "moved to" not in detail


def test_release_notes_are_history_even_with_the_version_in_the_name():
"""`release[-_ ]?notes` has been on `_HISTORICAL_NAMES` since the fastapi measurement,
and it could not see `docs/release_notes_v7.9.0.md`: after the name the pattern demanded
an extension or a slash, and a version number is neither.

`enarjord/passivbot` pays for that. Two of its five findings are release notes naming
config files deleted in later releases, and both documents are correct - the config
existed at the version the filename carries. Pillow escapes this only because its notes
sit in a `releasenotes/` DIRECTORY, which the path rule already reads.

Measured across every sweep batch, 147 finding lines: the widened pattern suppresses
exactly those two. The near misses are what keep it honest - a suffix that is a word,
not a version, still gets judged.
"""
from docproof.config import is_historical

for path in (
"docs/release_notes_v7.9.0.md",
"docs/release_notes_v7.10.0.md",
"docs/release-notes-2.rst",
"CHANGELOG-1.2.md",
"docs/migration_v2.md",
):
assert is_historical(path), path

for path in (
"docs/changelog-policy.md",
"docs/release-notes-process.md",
"docs/history-of-the-parser.md",
"docs/newsletter.md",
"README.md",
):
assert not is_historical(path), path
Loading