Skip to content

Commit

Permalink
Add null check before calling project_evaluated (#64)
Browse files Browse the repository at this point in the history
This PR adds a null check in the evaluate method of the Evaluation class
before calling project_evaluated on the formatter. This ensures that
project_evaluated is only called if there are models to evaluate, thus
skipping the output when no model is found.

#### Changes Made
Added a null check in the evaluate method of the Evaluation class.
  • Loading branch information
farmanp authored Jun 24, 2024
1 parent 0d845cc commit 1259fc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to

## [Unreleased]

- Add null check before calling `project_evaluated` in the `evaluate` method to
prevent errors when no models are found. See PR #64.

## [0.3.0] - 2024-06-20

### Added
Expand Down
5 changes: 4 additions & 1 deletion src/dbt_score/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ def evaluate(self) -> None:
self.project_score = self._scorer.score_aggregate_models(
list(self.scores.values())
)
self._formatter.project_evaluated(self.project_score)

# Add null check before calling project_evaluated
if self._manifest_loader.models:
self._formatter.project_evaluated(self.project_score)

0 comments on commit 1259fc2

Please sign in to comment.