From 4a414a474e1b050c0d19628808f1fb1e2a40e7c4 Mon Sep 17 00:00:00 2001 From: Jochem van Dooren Date: Wed, 29 May 2024 08:31:50 +0200 Subject: [PATCH] Improve model output --- src/dbt_score/formatters/human_readable_formatter.py | 5 +++-- tests/formatters/test_human_readable_formatter.py | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dbt_score/formatters/human_readable_formatter.py b/src/dbt_score/formatters/human_readable_formatter.py index 217422d..77340cb 100644 --- a/src/dbt_score/formatters/human_readable_formatter.py +++ b/src/dbt_score/formatters/human_readable_formatter.py @@ -25,7 +25,9 @@ def model_evaluated( self, model: Model, results: ModelResultsType, score: Score ) -> None: """Callback when a model has been evaluated.""" - print(f"Model {self.bold(model.name)}") + print( + f"{score.medal} {self.bold(model.name)} (score: {round(score.score, 1)!s})" + ) for rule, result in results.items(): if result is None: print(f"{self.indent}{self.label_ok} {rule.source()}") @@ -36,7 +38,6 @@ def model_evaluated( ) else: print(f"{self.indent}{self.label_error} {rule.source()}: {result!s}") - print(f"Score: {self.bold(str(round(score.score, 1)))} {score.medal}") print() def project_evaluated(self, score: Score) -> None: diff --git a/tests/formatters/test_human_readable_formatter.py b/tests/formatters/test_human_readable_formatter.py index c058f54..f86ee7c 100644 --- a/tests/formatters/test_human_readable_formatter.py +++ b/tests/formatters/test_human_readable_formatter.py @@ -26,11 +26,10 @@ def test_human_readable_formatter_model( stdout = capsys.readouterr().out assert ( stdout - == """Model \x1B[1mmodel1\x1B[0m + == """🥇 \x1B[1mmodel1\x1B[0m (score: 10.0) \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 (critical) tests.conftest.rule_severity_critical: Error -Score: \x1B[1m10.0\x1B[0m 🥇 """ )