-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2bf66c5
commit 8256171
Showing
4 changed files
with
40 additions
and
102 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""All general rules.""" | ||
|
||
from dbt_score.models import Model | ||
from dbt_score.rule import RuleViolation, rule | ||
|
||
|
||
@rule() | ||
def has_description(model: Model) -> RuleViolation | None: | ||
"""A model should have a description.""" | ||
if not model.description: | ||
return RuleViolation(message="Model lacks a description.") | ||
|
||
return None | ||
|
||
|
||
@rule() | ||
def columns_have_description(model: Model) -> RuleViolation | None: | ||
"""All columns of a model should have a description.""" | ||
invalid_column_names = [ | ||
column.name for column in model.columns if not column.description | ||
] | ||
if invalid_column_names: | ||
return RuleViolation( | ||
message=f"The following columns lack a description: " | ||
f"{', '.join(invalid_column_names)}." | ||
) | ||
|
||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters