generated from john/python-template
@@ -64,7 +64,10 @@ BASELINE_SCAN_EXCLUSIONS = frozenset(
|
||||
)
|
||||
|
||||
_BASELINE_DECLARATION = re.compile(r"Current Baseline:\s*V(\d+\.\d+)")
|
||||
_CURRENT_VERSION_CLAIM = re.compile(r"\b(?:current|active)\s+V(\d+\.\d+)", re.IGNORECASE)
|
||||
_BASELINE_CLAIM = re.compile(
|
||||
r"\b(?:Current Baseline:\s*|current\s+|active\s+|canonical\s+)V(\d+(?:\.\d+)?)",
|
||||
re.IGNORECASE,
|
||||
)
|
||||
|
||||
|
||||
def _declared_baseline() -> str:
|
||||
@@ -98,12 +101,7 @@ def test_canonical_docs_declare_one_consistent_baseline():
|
||||
for path in _baseline_scanned_docs():
|
||||
relative = path.relative_to(PROJECT_ROOT).as_posix()
|
||||
text = path.read_text(encoding="utf-8")
|
||||
stale = {
|
||||
version
|
||||
for pattern in (_BASELINE_DECLARATION, _CURRENT_VERSION_CLAIM)
|
||||
for version in pattern.findall(text)
|
||||
if version != baseline
|
||||
}
|
||||
stale = {version for version in _BASELINE_CLAIM.findall(text) if version != baseline}
|
||||
if stale:
|
||||
violations[relative] = sorted(stale)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user