Skip to content

Commit

Permalink
Add severity in rule violation printed results
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieucan committed Apr 19, 2024
1 parent b4e0f08 commit 33b24e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dbt_score/formatters/human_readable_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def model_evaluated(
elif isinstance(result, RuleViolation):
print(
f"{self.indent}{self.label_warning} "
f"{rule.source()}: {result.message}"
f"({rule.severity.name.lower()}) {rule.source()}: {result.message}"
)
else:
print(f"{self.indent}{self.label_error} {rule.source()}: {result!s}")
Expand Down
4 changes: 2 additions & 2 deletions tests/formatters/test_human_readable_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_human_readable_formatter_model(
results = {
rule_severity_low: None,
rule_severity_medium: Exception("Oh noes"),
rule_severity_critical: RuleViolation("Linting error"),
rule_severity_critical: RuleViolation("Error"),
}
formatter.model_evaluated(model1, results, 10.0)
stdout = capsys.readouterr().out
Expand All @@ -22,7 +22,7 @@ def test_human_readable_formatter_model(
== """Model \x1B[1mmodel1\x1B[0m
\x1B[1;32mOK \x1B[0m tests.conftest.rule_severity_low
\x1B[1;31mERR \x1B[0m tests.conftest.rule_severity_medium: Oh noes
\x1B[1;33mWARN\x1B[0m tests.conftest.rule_severity_critical: Linting error
\x1B[1;33mWARN\x1B[0m (critical) tests.conftest.rule_severity_critical: Error
Score: \x1B[1m100.0\x1B[0m
"""
Expand Down

0 comments on commit 33b24e3

Please sign in to comment.