You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/linter.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Linter guide
2
2
3
+

4
+
3
5
Linting is a powerful tool for improving code quality and consistency. It enables you to automatically validate model definition, ensuring they adhere to your team's best practices.
4
6
5
7
When a SQLMesh command is executed and the project is loaded, each model's code is checked for compliance with a set of rules you choose.
@@ -68,10 +70,10 @@ Here are all of SQLMesh's built-in linting rules:
| ambiguousorinvalidcolumn | Correctness | SQLMesh found duplicate columns or was unable to determine whether a column is duplicated or not |
72
-
| invalidselectstarexpansion | Correctness | The query's top-level selection may be `SELECT *`, but only if SQLMesh can expand the `SELECT *` into individual columns |
73
-
| noselectstar | Stylistic | The query's top-level selection may not be `SELECT *`, even if SQLMesh can expand the `SELECT *` into individual columns |
74
-
73
+
|`ambiguousorinvalidcolumn`| Correctness | SQLMesh found duplicate columns or was unable to determine whether a column is duplicated or not |
74
+
|`invalidselectstarexpansion`| Correctness | The query's top-level selection may be `SELECT *`, but only if SQLMesh can expand the `SELECT *` into individual columns |
75
+
|`noselectstar`| Stylistic | The query's top-level selection may not be `SELECT *`, even if SQLMesh can expand the `SELECT *` into individual columns |
76
+
|`nomissingaudits`| Governance | SQLMesh did not find any `audits` in the model's configuration to test data quality. |
75
77
76
78
### User-defined rules
77
79
@@ -211,7 +213,7 @@ MODEL(
211
213
212
214
Linting rule violations raise an error by default, preventing the project from running until the violation is addressed.
213
215
214
-
You may specify that a rule's violation should not error and only log a warning by specifying it in the `warning_rules` key instead of the `rules` key.
216
+
You may specify that a rule's violation should not error and only log a warning by specifying it in the `warn_rules` key instead of the `rules` key.
215
217
216
218
=== "YAML"
217
219
@@ -221,7 +223,7 @@ You may specify that a rule's violation should not error and only log a warning
221
223
# error if `ambiguousorinvalidcolumn` rule violated
222
224
rules: ["ambiguousorinvalidcolumn"]
223
225
# but only warn if "invalidselectstarexpansion" is violated
224
-
warning_rules: ["invalidselectstarexpansion"]
226
+
warn_rules: ["invalidselectstarexpansion"]
225
227
```
226
228
227
229
=== "Python"
@@ -235,9 +237,9 @@ You may specify that a rule's violation should not error and only log a warning
235
237
# error if `ambiguousorinvalidcolumn` rule violated
236
238
rules=["ambiguousorinvalidcolumn"],
237
239
# but only warn if "invalidselectstarexpansion" is violated
238
-
warning_rules=["invalidselectstarexpansion"],
240
+
warn_rules=["invalidselectstarexpansion"],
239
241
)
240
242
)
241
243
```
242
244
243
-
SQLMesh will raise an error if the same rule is included in more than one of the `rules`, `warning_rules`, and `ignored_rules` keys since they should be mutually exclusive.
245
+
SQLMesh will raise an error if the same rule is included in more than one of the `rules`, `warn_rules`, and `ignored_rules` keys since they should be mutually exclusive.
0 commit comments