fix: fail a truth diff that compared nothing

This commit is contained in:
Abdessamad Derraz committed 2026-10-06 05:09:11 +02:00
1 parent e4cc978614
commit ae0bbb9d3c
2 files changed
+27 -7

No files matched your search

+8 -7
View File
@@ -179,26 +179,23 @@ def main() -> None:
reports: list[dict] = []
formatter = _format_markdown if args.format == "markdown" else _format_terminal
compared = 0
for platform in platforms:
truth = _load_truth(args.truth_dir, platform)
if truth is None:
if not args.json_output:
print(
f"skip {platform}: no truth YAML in {args.truth_dir}/",
file=sys.stderr,
)
print(f"skip {platform}: no truth YAML in {args.truth_dir}/", file=sys.stderr)
continue
try:
scraped = load_platform_config(platform, args.platforms_dir)
except FileNotFoundError:
if not args.json_output:
print(f"skip {platform}: no scraped config", file=sys.stderr)
print(f"skip {platform}: no scraped config", file=sys.stderr)
continue
report = diff_platform_truth(truth, scraped)
report["platform"] = platform
compared += 1
if args.json_output:
reports.append(report)
@@ -210,6 +207,10 @@ def main() -> None:
json.dump(reports, sys.stdout, indent=2)
print()
if compared < len(platforms) and (args.platform or not compared):
print(f"compared {compared} of {len(platforms)} platform(s)", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()