File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -100,13 +100,23 @@ def has_uniqueness_test(model: Model) -> RuleViolation | None:
100100 pk_columns = model_constraint .columns or []
101101 break
102102
103- if not pk_columns : # No PK, no need for uniqueness test
103+ if not pk_columns : # No PK, no need for uniqueness test
104104 return None
105105
106106 for data_test in model .tests :
107107 if data_test .type == "unique_combination_of_columns" :
108- if set (data_test .kwargs .get ("combination_of_columns" )) == set (pk_columns ): # type: ignore
108+ if set (data_test .kwargs .get ("combination_of_columns" )) == set (pk_columns ): # type: ignore
109109 return None
110110 return RuleViolation (
111111 f"No uniqueness test defined and matching PK { ',' .join (pk_columns )} ."
112112 )
113+
114+
115+ @rule (rule_filters = {is_table ()})
116+ def has_no_unused_is_incremental (model : Model ) -> RuleViolation | None :
117+ """Non-incremental model does not make use of is_incremental()."""
118+ if (
119+ model .config .get ("materialized" ) != "incremental"
120+ and "is_incremental()" in model .raw_code
121+ ):
122+ return RuleViolation ("Non-incremental model makes use of is_incremental()." )
You can’t perform that action at this time.
0 commit comments