From 21f3014d331bf93f2013f351a3e82c740a8d2b67 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Wed, 16 Oct 2024 23:31:30 -0400 Subject: [PATCH] fix: Fix validate_config function name --- src/makim/core.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/makim/core.py b/src/makim/core.py index a944a1d..4c83180 100644 --- a/src/makim/core.py +++ b/src/makim/core.py @@ -33,7 +33,7 @@ from makim.console import get_terminal_size from makim.logs import MakimError, MakimLogs -SUGAR_CURRENT_PATH = Path(__file__).parent +MAKIM_CURRENT_PATH = Path(__file__).parent AppConfigType: TypeAlias = Dict[str, Union[str, List[str]]] @@ -175,19 +175,7 @@ def _call_shell_app(self, cmd: str) -> None: def _check_makim_file(self, file_path: str = '') -> bool: return Path(file_path or self.file).exists() - def _verify_task_conditional(self, conditional: Any) -> bool: - # todo: implement verification - print(f'condition {conditional} not verified') - return False - - def _verify_args(self) -> None: - if not self._check_makim_file(): - MakimLogs.raise_error( - f'Makim file {self.file} not found.', - MakimError.MAKIM_CONFIG_FILE_NOT_FOUND, - ) - - def validate_config(self) -> None: + def _validate_config(self) -> None: """ Validate the .makim.yaml against the predefined JSON Schema. @@ -196,7 +184,7 @@ def validate_config(self) -> None: MakimError: If the configuration does not conform to the schema. """ try: - with open(SUGAR_CURRENT_PATH / 'schema.json', 'r') as schema_file: + with open(MAKIM_CURRENT_PATH / 'schema.json', 'r') as schema_file: schema = json.load(schema_file) config_data = self.global_data @@ -233,6 +221,18 @@ def validate_config(self) -> None: error_message, MakimError.CONFIG_VALIDATION_UNEXPECTED_ERROR ) + def _verify_task_conditional(self, conditional: Any) -> bool: + # todo: implement verification + print(f'condition {conditional} not verified') + return False + + def _verify_args(self) -> None: + if not self._check_makim_file(): + MakimLogs.raise_error( + f'Makim file {self.file} not found.', + MakimError.MAKIM_CONFIG_FILE_NOT_FOUND, + ) + def _verify_config(self) -> None: if not len(self.global_data['groups']): MakimLogs.raise_error( @@ -289,7 +289,7 @@ def _load_config_data(self) -> None: content_io = io.StringIO(content) self.global_data = yaml.safe_load(content_io) - self.validate_config() + self._validate_config() def _resolve_working_directory(self, scope: str) -> Optional[Path]: scope_options = ('global', 'group', 'task')