Skip to content

Commit

Permalink
Merge pull request #25 from codesquadnest/pb/issue-24
Browse files Browse the repository at this point in the history
Beautify error output
  • Loading branch information
pmpbaptista authored Dec 5, 2023
2 parents 7d5f579 + fab1eaa commit 0dc085c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions zuulcilint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,19 @@ def lint(file_path: str, schema: dict) -> int:
obj = yaml.safe_load(yaml_in)
va_errors = validator.iter_errors(obj)
for e in va_errors:
print(e, file=sys.stderr)
zuul_utils.print_bold("Validation error:", "error")
print(f" File: {file_path}")
print(f" Message: {e.message}")
print(f" Path: {list(e.path)}")
print(f" Schema Path: {list(e.schema_path)}\n")
errors += 1
except yaml.YAMLError as e:
print(e)
print(f"YAML Parse Error: {e}")
errors += 1
except FileNotFoundError as e:
print(f"{e.filename} not found!\nExiting")
sys.exit(1)

return errors


Expand Down

0 comments on commit 0dc085c

Please sign in to comment.