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
2 changes: 1 addition & 1 deletion .github/scripts/_url_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def check_url(entry: dict[str, Any], timeout: int = 15) -> CheckResult:
time.sleep(0.25 * (attempt + 1))
continue
return CheckResult("ERROR", tracker.count, str(exc), entry["url"])
raise AssertionError("unreachable")
raise RuntimeError("unreachable — for loop always returns")


def contract_drift_reasons(entry: dict[str, Any], result: CheckResult) -> list[str]:
Expand Down
12 changes: 0 additions & 12 deletions scripts/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,6 @@ def fail(message: str, hint: str | None = None) -> None:
print(f" HINT: {hint}", file=sys.stderr)


def contains_markdown_phrase(text: str, phrase: str) -> bool:
"""Check if *phrase* exists in *text* with whitespace normalization.

Collapses runs of whitespace (spaces, tabs, newlines) to single spaces
before matching, so formatting changes don't cause false negatives.
"""
import re as _re
normalized = _re.sub(r"\s+", " ", text)
phrase_normalized = _re.sub(r"\s+", " ", phrase)
return phrase_normalized in normalized


# ── unsafe probe detection ────────────────────────────────────────────────

UNSAFE_PROBE_PATTERNS: list[tuple[str, str]] = [
Expand Down
13 changes: 6 additions & 7 deletions scripts/check-version-consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,15 @@ def main() -> int:
return 0

# Check consistency
versions = set(sources.values())
if len(versions) > 1:
citation_ver = sources.get(CITATION_CFF)
pyproject_ver = sources.get(PYPROJECT_TOML)
if citation_ver != pyproject_ver:
for source, ver in sorted(sources.items()):
errors.append(f"version-mismatch: {source} has version {ver!r}")
# Show what they should be
most_common = max(versions, key=lambda v: sum(1 for sv in sources.values() if sv == v))
errors.append(f"version-mismatch: expected all sources to use {most_common!r}")
expected = citation_ver or pyproject_ver
errors.append(f"version-mismatch: expected all sources to use {expected!r}")
else:
ver = versions.pop()
print(f"PASS: all version sources agree on {ver!r}")
print(f"PASS: all version sources agree on {citation_ver!r}")

if errors:
for error in errors:
Expand Down
3 changes: 1 addition & 2 deletions scripts/cron-health.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
import re
import sys

from _common import ROOT, find_markdown_files
from _common import ROOT, SKILL_REF_RE, find_markdown_files

RELATIVE_LINK_RE = re.compile(r"\[.*?\]\(((?!https?://|mailto:|#)[^)]+)\)")
SKILL_REF_RE = re.compile(r"\]\((references/[^)\s]+\.md)\)")


def check_link_rot() -> list[str]:
Expand Down