24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Validate the current POM-only foundation and portable local documentation."""
|
|
from pathlib import Path
|
|
import json
|
|
import os
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
wrapper = ROOT / ("mvnw.cmd" if os.name == "nt" else "mvnw")
|
|
subprocess.run([str(wrapper), "--batch-mode", "--no-transfer-progress", "clean", "verify"], cwd=ROOT, check=True)
|
|
for document in [ROOT / "README.md", ROOT / "AGENTS.md", ROOT / "THIRD-PARTY-NOTICES.md", *sorted((ROOT / "docs").rglob("*.md"))]:
|
|
content = document.read_text(encoding="utf-8")
|
|
for example in re.findall(r"```json\n(.*?)\n```", content, re.S):
|
|
json.loads(example)
|
|
for target in re.findall(r"\]\(([^)]+)\)", content):
|
|
if "://" in target or target.startswith("#"):
|
|
continue
|
|
local = document.parent / target.split("#", 1)[0]
|
|
if not local.exists():
|
|
sys.exit(f"Broken local link in {document.relative_to(ROOT)}: {target}")
|
|
print("PASS Maven foundation, local document links and JSON examples (no application tests yet)")
|