Skip to content

Commit

Permalink
Factor out severity
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieucan committed Aug 8, 2024
1 parent 81a5a86 commit c887978
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dbt_score/formatters/json_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,23 @@ def model_evaluated(
"results": {},
}
for rule, result in results.items():
severity = rule.severity.name.lower()
if result is None:
self._model_results[model.name]["results"][rule.source()] = {
"result": "OK",
"severity": rule.severity.name.lower(),
"severity": severity,
"message": None,
}
elif isinstance(result, RuleViolation):
self._model_results[model.name]["results"][rule.source()] = {
"result": "WARN",
"severity": rule.severity.name.lower(),
"severity": severity,
"message": result.message,
}
else:
self._model_results[model.name]["results"][rule.source()] = {
"result": "ERR",
"severity": rule.severity.name.lower(),
"severity": severity,
"message": str(result),
}

Expand Down

0 comments on commit c887978

Please sign in to comment.