Skip to content

Commit

Permalink
Fix model selection when no models are specified (#37)
Browse files Browse the repository at this point in the history
Fix the issue where no models are linted when no `--select` is provided.

At the same time, add a test that checks this behavior.
  • Loading branch information
jochemvandooren authored Jun 3, 2024
1 parent 948eb78 commit 1db5b69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dbt_score/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def __init__(self, file_path: Path, select: Iterable[str] | None = None):
self._reindex_tests()
self._load_models()

if select is not None:
if select:
self._select_models(select)

if len(self.models) == 0:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def test_lint_existing_manifest(manifest_path):
with patch("dbt_score.cli.Config._load_toml_file"):
runner = CliRunner()
result = runner.invoke(lint, ["--manifest", manifest_path])

assert "model1" in result.output
assert "model2" in result.output
assert result.exit_code == 0


Expand Down

0 comments on commit 1db5b69

Please sign in to comment.