()
| 6 | |
| 7 | |
| 8 | def main() -> int: |
| 9 | yaml_files = git_ls_files("*.yml", "*.yaml") |
| 10 | |
| 11 | if not yaml_files: |
| 12 | print("No YAML files found. Skipping YAML validation.") |
| 13 | return 0 |
| 14 | |
| 15 | failed = False |
| 16 | |
| 17 | for path in yaml_files: |
| 18 | print(f"Validating YAML: {display_path(path)}") |
| 19 | |
| 20 | try: |
| 21 | yaml.safe_load(read_text(path)) |
| 22 | except Exception as exc: |
| 23 | print(f"FAILED: {display_path(path)}: {exc}") |
| 24 | failed = True |
| 25 | |
| 26 | return 1 if failed else 0 |
| 27 | |
| 28 | |
| 29 | if __name__ == "__main__": |
no test coverage detected