Skip to content

Commit 9940af0

Browse files
committed
chore: breaking apart console interface
1 parent 2d87813 commit 9940af0

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

sqlmesh/core/console.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
RED_X_MARK = "\u274c"
8484

8585

86-
class Console(abc.ABC):
86+
class Console(abc.ABC, LinterConsole):
8787
"""Abstract base class for defining classes used for displaying information to the user and also interact
8888
with them when their input is needed."""
8989

@@ -400,6 +400,8 @@ def _limit_model_names(self, tree: Tree, verbosity: Verbosity = Verbosity.DEFAUL
400400
]
401401
return tree
402402

403+
404+
class LinterConsole(abc.ABC):
403405
@abc.abstractmethod
404406
def show_linter_violations(
405407
self, violations: t.List[RuleViolation], model: Model, is_error: bool = False

sqlmesh/core/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,6 +2475,8 @@ def lint_models(
24752475
raise LinterError(
24762476
"Linter detected errors in the code. Please fix them before proceeding."
24772477
)
2478+
2479+
def _lint_models(s)
24782480

24792481
def load_model_tests(
24802482
self, tests: t.Optional[t.List[str]] = None, patterns: list[str] | None = None

sqlmesh/core/linter/definition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from sqlmesh.core.model import Model
88

99
from sqlmesh.utils.errors import raise_config_error
10-
from sqlmesh.core.console import get_console, Console
10+
from sqlmesh.core.console import LinterConsole, get_console, Console
1111
from sqlmesh.core.linter.rule import RuleSet
1212

1313

@@ -50,7 +50,7 @@ def from_rules(cls, all_rules: RuleSet, config: LinterConfig) -> Linter:
5050

5151
return Linter(config.enabled, all_rules, rules, warn_rules)
5252

53-
def lint_model(self, model: Model, console: Console = get_console()) -> bool:
53+
def lint_model(self, model: Model, console: LinterConsole = get_console()) -> bool:
5454
if not self.enabled:
5555
return False
5656

0 commit comments

Comments
 (0)