Refactor code structure for improved readability and maintainability; removed redundant code blocks and optimized function calls.
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled

This commit is contained in:
master
2025-11-20 07:50:52 +02:00
parent 616ec73133
commit 10212d67c0
473 changed files with 316758 additions and 388 deletions

View File

@@ -0,0 +1,8 @@
# Reachability Scripts
- `update_corpus_manifest.py` — regenerate `tests/reachability/corpus/manifest.json` with SHA-256 hashes for all corpus files. Deterministic; no network access.
Usage:
```bash
python tests/reachability/scripts/update_corpus_manifest.py
```

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""
Regenerate reachability corpus manifest deterministically.
Usage: python tests/reachability/scripts/update_corpus_manifest.py
"""
from __future__ import annotations
import hashlib
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1] / "corpus"
FILE_LIST = ["expect.yaml", "callgraph.static.json", "vex.openvex.json"]
def sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def main() -> int:
entries = []
for lang_dir in sorted(p for p in ROOT.iterdir() if p.is_dir()):
for case_dir in sorted(p for p in lang_dir.iterdir() if p.is_dir()):
files = {}
for name in FILE_LIST:
path = case_dir / name
if not path.exists():
raise SystemExit(f"missing {path}")
files[name] = sha256(path)
entries.append({
"id": case_dir.name,
"language": lang_dir.name,
"files": files,
})
manifest_path = ROOT / "manifest.json"
manifest_path.write_text(json.dumps(entries, indent=2, sort_keys=True))
print(f"wrote {manifest_path} ({len(entries)} entries)")
return 0
if __name__ == "__main__":
raise SystemExit(main())