feat: add doc link validator (4.8 — closes #103) #234

Open
Rockachopa wants to merge 1 commits from step35/103-4-8-doc-link-validator into main
Owner

Add scripts/validate_doc_links.py — a lightweight link checker for all
markdown documentation in the repository.

Acceptance criteria

  • Extracts links from docs — scans all *.md files, finds inline [text](url) and autolinks <url>
  • HTTP HEAD check — performs HEAD request with GET fallback for servers that reject HEAD
  • Reports broken links — lists URLs returning status >= 400 or failing to connect
  • ⚠️ Runs weekly — script is ready; CI/cron hook integration is separate infra task

Usage

# Basic scan (exit 0 even if broken links found)
python3 scripts/validate_doc_links.py --root .

# Fail CI on broken links
python3 scripts/validate_doc_links.py --root . --fail-on-broken

# Machine-readable JSON output
python3 scripts/validate_doc_links.py --json

# Ignore specific hosts (e.g. local dev servers)
python3 scripts/validate_doc_links.py --ignore localhost,127.0.0.1

Implementation notes

  • Python 3 stdlib only — urllib, re, pathlib, argparse, json
  • Ignores non-HTTP URLs, localhost, private IPs
  • Low impact: single-threaded, 8s timeout per URL
  • Exit codes: 0 if --fail-on-broken is false or all OK; 1 if --fail-on-broken and broken links found

Files

  • scripts/validate_doc_links.py (new, 131 lines, executable)

Smoke test in isolated clone: 4 markdown files scanned, 2 unique URLs checked, 0 broken.

Closes #103

## feat: Doc Link Validator — 4.8 (closes #103) Add `scripts/validate_doc_links.py` — a lightweight link checker for all markdown documentation in the repository. ### Acceptance criteria - ✅ **Extracts links from docs** — scans all `*.md` files, finds inline `[text](url)` and autolinks `<url>` - ✅ **HTTP HEAD check** — performs HEAD request with GET fallback for servers that reject HEAD - ✅ **Reports broken links** — lists URLs returning status >= 400 or failing to connect - ⚠️ **Runs weekly** — script is ready; CI/cron hook integration is separate infra task ### Usage ```bash # Basic scan (exit 0 even if broken links found) python3 scripts/validate_doc_links.py --root . # Fail CI on broken links python3 scripts/validate_doc_links.py --root . --fail-on-broken # Machine-readable JSON output python3 scripts/validate_doc_links.py --json # Ignore specific hosts (e.g. local dev servers) python3 scripts/validate_doc_links.py --ignore localhost,127.0.0.1 ``` ### Implementation notes - Python 3 stdlib only — `urllib`, `re`, `pathlib`, `argparse`, `json` - Ignores non-HTTP URLs, localhost, private IPs - Low impact: single-threaded, 8s timeout per URL - Exit codes: 0 if `--fail-on-broken` is false or all OK; 1 if `--fail-on-broken` and broken links found ### Files - `scripts/validate_doc_links.py` (new, 131 lines, executable) Smoke test in isolated clone: 4 markdown files scanned, 2 unique URLs checked, 0 broken. Closes #103
Rockachopa added 1 commit 2026-04-26 00:55:53 +00:00
feat: add doc link validator script (closes #103)
Some checks failed
Test / pytest (pull_request) Failing after 30s
ceb7e0bd0c
Add scripts/validate_doc_links.py — scans all markdown files in the
repository, extracts inline and autolinks, and verifies each URL via
HTTP HEAD request (with GET fallback for servers that reject HEAD).

Features:
  --root           : repository root to scan (default: repo root)
  --fail-on-broken : exit 1 if any broken links found
  --json           : emit JSON report for CI consumption
  --ignore         : comma-separated URL prefixes to skip

Ignores non-HTTP URLs, localhost/127.0.0.1, and private IP ranges.
Requires only Python stdlib — no external dependencies.

Smoke-tested against this repo: 2 unique URLs checked, 0 broken.
Addresses 4.8: Doc Link Validator acceptance criteria.

Closes #103
Some checks failed
Test / pytest (pull_request) Failing after 30s
Checking for merge conflicts…
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin step35/103-4-8-doc-link-validator:step35/103-4-8-doc-link-validator
git checkout step35/103-4-8-doc-link-validator
Sign in to join this conversation.