Skip to content

Commit

Permalink
fix: Fix validate_config function name (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab authored Oct 17, 2024
1 parent ee5b7e5 commit d92a9c6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/makim/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]]

Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit d92a9c6

Please sign in to comment.