From edd4a7b704359ddb0775156be3fffd705b77fcf5 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem <4048546+olehermanse@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:16:09 +0100 Subject: [PATCH] Improved some validation warning messages Code review suggestions from @craigcomstock Co-authored-by: Craig Comstock Signed-off-by: Ole Herman Schumacher Elgesem --- cfbs/validate.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cfbs/validate.py b/cfbs/validate.py index 32b94410..1f354831 100644 --- a/cfbs/validate.py +++ b/cfbs/validate.py @@ -271,7 +271,9 @@ def validate_steps(name, module): if not operation in AVAILABLE_BUILD_STEPS: x = ", ".join(AVAILABLE_BUILD_STEPS) raise CFBSValidationError( - name, 'Unknown operation in "steps", must be one of: (%s)' % x + name, + 'Unknown operation "%s" in "steps", must be one of: (%s)' + % (operation, x), ) expected = AVAILABLE_BUILD_STEPS[operation] actual = len(args) @@ -341,18 +343,20 @@ def validate_module_input(name, module): if not re.fullmatch(r"[a-z_]+", input_element["variable"]): raise CFBSValidationError( name, - '"%s" is not an acceptable variable name' + '"%s" is not an acceptable variable name, must match regex "[a-z_]+"' % input_element["variable"], ) if not re.fullmatch(r"[a-z_]+", input_element["namespace"]): raise CFBSValidationError( name, - '"%s" is not an acceptable namespace' % input_element["namespace"], + '"%s" is not an acceptable namespace, must match regex "[a-z_]+"' + % input_element["namespace"], ) if not re.fullmatch(r"[a-z_]+", input_element["bundle"]): raise CFBSValidationError( name, - '"%s" is not an acceptable bundle name' % input_element["bundle"], + '"%s" is not an acceptable bundle name, must match regex "[a-z_]+"' + % input_element["bundle"], ) if input_element["type"] == "list":