Skip to content

validate

trestle.core.commands.validate ¤

Trestle Validate Command.

logger ¤

Classes¤

ValidateCmd (CommandPlusDocs) ¤

Validate contents of a trestle model in different modes.

Source code in trestle/core/commands/validate.py
class ValidateCmd(CommandPlusDocs):
    """Validate contents of a trestle model in different modes."""

    name = ARG_VALIDATE

    def _init_arguments(self) -> None:
        vfact.init_arguments(self)

    def _run(self, args: argparse.Namespace) -> int:
        try:
            log.set_log_level_from_args(args)

            mode_args = argparse.Namespace(mode=VAL_MODE_ALL)
            validator = vfact.validator_factory.get(mode_args)

            return validator.validate(args)
        except Exception as e:  # pragma: no cover
            return handle_generic_command_exception(e, logger, 'Error while validating contents of a trestle model')
name ¤

handler: python