Skip to content

Commit 5898932

Browse files
committed
pr feedback
1 parent b6c7a69 commit 5898932

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

docs/guides/linter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Here are all of SQLMesh's built-in linting rules:
7575
| `noselectstar` | Stylistic | The query's top-level selection may not be `SELECT *`, even if SQLMesh can expand the `SELECT *` into individual columns |
7676
| `nomissingaudits` | Governance | SQLMesh did not find any `audits` in the model's configuration to test data quality. |
7777
| `nomissingexternalmodels` | Governance | All external models must be registered in the external_models.yaml file |
78-
| `cronvalidator` | Governance | Upstream model has a cron expression with longer intervals than downstream model. Example: step_1(`@weekly`) -> step_2(`@daily`) -> step_3(`*/5 * * * *`). step_2 and step_3 are anchored to step_1's cron and will run on the same schedule as step_1. The fix is to align the schedules where a downstream model's cron is the same or has a longer cron interval than an upstream model's. |
78+
| `cronintervalalignment` | Governance | Upstream model has a cron expression with longer intervals than downstream model. Example: step_1(`@weekly`) -> step_2(`@daily`) -> step_3(`*/5 * * * *`). step_2 and step_3 are anchored to step_1's cron and will run on the same schedule as step_1. The fix is to align the schedules where a downstream model's cron is the same or has a longer cron interval than an upstream model's. |
7979

8080
### User-defined rules
8181

examples/sushi/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"nomissingaudits",
5050
"nomissingowner",
5151
"nomissingexternalmodels",
52-
"cronvalidator",
52+
"cronintervalalignment",
5353
],
5454
),
5555
)

sqlmesh/core/linter/rules/builtin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
CreateFile,
2525
)
2626
from sqlmesh.core.linter.definition import RuleSet
27-
from sqlmesh.core.model import Model, SqlModel, ExternalModel
27+
from sqlmesh.core.model import Model, SqlModel, ExternalModel, ModelKindName
2828
from sqlmesh.utils.lineage import extract_references_from_query, ExternalModelReference
2929

3030

@@ -274,7 +274,7 @@ def create_fix(self, model_name: str) -> t.Optional[Fix]:
274274
)
275275

276276

277-
class CronValidator(Rule):
277+
class CronIntervalAlignment(Rule):
278278
"""Upstream model has a cron expression with longer intervals than downstream model."""
279279

280280
def check_model(self, model: Model) -> t.Optional[RuleViolation]:
@@ -290,7 +290,7 @@ def check_model(self, model: Model) -> t.Optional[RuleViolation]:
290290
continue
291291

292292
# Skip model kinds since they don't run on cron schedules
293-
skip_kinds = ["EXTERNAL", "EMBEDDED", "SEED"]
293+
skip_kinds = [ModelKindName.EXTERNAL, ModelKindName.EMBEDDED, ModelKindName.SEED]
294294
if upstream_model.kind.name in skip_kinds:
295295
continue
296296

tests/core/linter/test_builtin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_no_missing_external_models(tmp_path, copy_to_temp_path) -> None:
3333
"nomissingaudits",
3434
"nomissingowner",
3535
"nomissingexternalmodels",
36-
"cronvalidator",
36+
"cronintervalalignment",
3737
],
3838
),"""
3939
after = """linter=LinterConfig(enabled=True, rules=["nomissingexternalmodels"]),"""
@@ -87,7 +87,7 @@ def test_no_missing_external_models_with_existing_file_ending_in_newline(
8787
"nomissingaudits",
8888
"nomissingowner",
8989
"nomissingexternalmodels",
90-
"cronvalidator",
90+
"cronintervalalignment",
9191
],
9292
),"""
9393
after = """linter=LinterConfig(enabled=True, rules=["nomissingexternalmodels"]),"""
@@ -145,7 +145,7 @@ def test_no_missing_external_models_with_existing_file_not_ending_in_newline(
145145
"nomissingaudits",
146146
"nomissingowner",
147147
"nomissingexternalmodels",
148-
"cronvalidator",
148+
"cronintervalalignment",
149149
],
150150
),"""
151151
after = """linter=LinterConfig(enabled=True, rules=["nomissingexternalmodels"]),"""
@@ -196,10 +196,10 @@ def test_cron_validator(tmp_path, copy_to_temp_path) -> None:
196196
"nomissingaudits",
197197
"nomissingowner",
198198
"nomissingexternalmodels",
199-
"cronvalidator",
199+
"cronintervalalignment",
200200
],
201201
),"""
202-
after = """linter=LinterConfig(enabled=True, rules=["cronvalidator"]),"""
202+
after = """linter=LinterConfig(enabled=True, rules=["cronintervalalignment"]),"""
203203
read_file = read_file.replace(before, after)
204204
assert after in read_file
205205
with open(sushi_path / "config.py", "w") as f:

tests/lsp/test_code_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_code_actions_create_file(copy_to_temp_path: t.Callable) -> None:
131131
"nomissingaudits",
132132
"nomissingowner",
133133
"nomissingexternalmodels",
134-
"cronvalidator",
134+
"cronintervalalignment",
135135
],
136136
),"""
137137
after = """linter=LinterConfig(enabled=True, rules=["nomissingexternalmodels"]),"""

tests/lsp/test_reference_external_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_unregistered_external_model_with_schema(
9494
"nomissingaudits",
9595
"nomissingowner",
9696
"nomissingexternalmodels",
97-
"cronvalidator",
97+
"cronintervalalignment",
9898
],
9999
),"""
100100
after = """linter=LinterConfig(enabled=True, rules=["nomissingexternalmodels"]),"""

vscode/extension/tests/quickfix.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test.fixme(
3535
"nomissingaudits",
3636
"nomissingowner",
3737
"nomissingexternalmodels",
38-
"cronvalidator",
38+
"cronintervalalignment",
3939
],`,
4040
targetRules,
4141
)

0 commit comments

Comments
 (0)