Fixed formatting issues

This commit is contained in:
richardpaulhudson 2022-05-10 09:51:37 +02:00
parent a2bd489a8c
commit 8c8b81a413
2 changed files with 18 additions and 16 deletions

View File

@ -225,12 +225,12 @@ def validate_project_commands(config: Dict[str, Any]) -> None:
def verify_workflow_step(step: str): def verify_workflow_step(step: str):
if step not in command_names: if step not in command_names:
msg.fail( msg.fail(
f"Unknown command specified in workflow '{workflow_name}': {step}", f"Unknown command specified in workflow '{workflow_name}': {step}",
f"Workflows can only refer to commands defined in the 'commands' " f"Workflows can only refer to commands defined in the 'commands' "
f"section of the {PROJECT_FILE}.", f"section of the {PROJECT_FILE}.",
exits=1, exits=1,
) )
command_names = [cmd["name"] for cmd in config.get("commands", [])] command_names = [cmd["name"] for cmd in config.get("commands", [])]
workflows = config.get("workflows", {}) workflows = config.get("workflows", {})
@ -249,16 +249,16 @@ def validate_project_commands(config: Dict[str, Any]) -> None:
workflow_list = cast(List[str], step_or_list) workflow_list = cast(List[str], step_or_list)
if len(workflow_list) < 2: if len(workflow_list) < 2:
msg.fail( msg.fail(
f"Invalid multiprocessing group within '{workflow_name}'.", f"Invalid multiprocessing group within '{workflow_name}'.",
f"A multiprocessing group must reference at least two commands.", f"A multiprocessing group must reference at least two commands.",
exits=1, exits=1,
) )
if len(workflow_list) != len(set(workflow_list)): if len(workflow_list) != len(set(workflow_list)):
msg.fail( msg.fail(
f"A multiprocessing group within '{workflow_name}' contains a command more than once.", f"A multiprocessing group within '{workflow_name}' contains a command more than once.",
f"This is not permitted because it is then not possible to determine when to rerun.", f"This is not permitted because it is then not possible to determine when to rerun.",
exits=1, exits=1,
) )
for step in workflow_list: for step in workflow_list:
verify_workflow_step(step) verify_workflow_step(step)

View File

@ -76,7 +76,9 @@ def project_document(
if isinstance(step, str): if isinstance(step, str):
rendered_steps.append(md.code(step)) rendered_steps.append(md.code(step))
else: else:
rendered_steps.append('[' + ', '.join(md.code(p_step) for p_step in step) + ']') rendered_steps.append(
"[" + ", ".join(md.code(p_step) for p_step in step) + "]"
)
data.append([md.code(n), " &rarr; ".join(rendered_steps)]) data.append([md.code(n), " &rarr; ".join(rendered_steps)])
if data: if data:
md.add(md.title(3, "Workflows", "")) md.add(md.title(3, "Workflows", ""))