-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON formatter for machine-readable output #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good! 🚀
for rule, result in results.items(): | ||
if result is None: | ||
self._model_results[model.name]["results"][rule.source()] = { | ||
"result": "OK", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can make this an Enum or something, so it's clear what are the possible results codes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, but given it's also used in the HumanReadableFormatter
, this would require a bit of refactoring to have it proper. I suggest to keep it simple for now :)
Co-authored-by: Jochem van Dooren <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! 🚀 I'll leave the Enum
comment up to you 👍
"pass": true, | ||
"results": { | ||
"tests.conftest.rule_severity_low": { | ||
"result": "OK", | ||
"severity": "low", | ||
"message": null | ||
}, | ||
"tests.conftest.rule_severity_medium": { | ||
"result": "ERR", | ||
"severity": "medium", | ||
"message": "Oh noes" | ||
}, | ||
"tests.conftest.rule_severity_critical": { | ||
"result": "WARN", | ||
"severity": "critical", | ||
"message": "Error" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting pass
considering the rules.result
😁 Not a problem though!
The ability to save and use results from dbt-score in other tooling opens new possibilities.
To that end, add a new formatter, which uses
stdout
to print a JSON document displayingdbt-score
's results.Example: