refactor: split this round's fixes into small helpers

This commit is contained in:
Abdessamad Derraz committed 2026-10-06 11:16:06 +02:00
1 parent 70d6f431e3
commit f3d01aeeeb
15 files changed
+218 -157

No files matched your search

+9 -11
View File
@@ -268,6 +268,14 @@ def unchecked_formats() -> list[str]:
return sorted(used - set(FormatChecker().checkers))
def _format_errors() -> list[str]:
"""jsonschema skips a format it has no checker for: say so, and fail."""
return [
f"no checker for format {name}: install \"jsonschema[format-nongpl]\""
for name in unchecked_formats()
]
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
@@ -277,17 +285,7 @@ def main() -> int:
)
args = parser.parse_args()
unchecked = unchecked_formats()
if unchecked:
# jsonschema skips a format it has no checker for, silently.
print(
f"ERROR no checker for format(s) {', '.join(unchecked)}: "
'install "jsonschema[format-nongpl]"',
file=sys.stderr,
)
return 1
errors: list[str] = []
errors: list[str] = _format_errors()
errors.extend(
_validate_yaml_directory(ROOT / "emulators", "emulator.schema.json")
)