Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix validate_config function name #123

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading