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

Misc workflow linting improvements #1437

Merged
merged 2 commits into from
Mar 21, 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
18 changes: 12 additions & 6 deletions planemo/workflow_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ def check_json_for_untyped_params(j):

# checks on individual steps
for step in steps.values():
print(step)
# disconnected inputs
for input in step.get("inputs", []):
if input.get("name") not in step.get("input_connections"): # TODO: check optional
lint_context.warn(
f"Input {input.get('name')} of workflow step {step.get('annotation') or step.get('id')} is disconnected."
)
if step.get("type") not in ["data_collection_input", "parameter_input"]:
for input in step.get("inputs", []):
if input.get("name") not in step.get("input_connections"): # TODO: check optional
lint_context.warn(
f"Input {input.get('name')} of workflow step {step.get('annotation') or step.get('id')} is disconnected."
)

# missing metadata
if not step.get("annotation"):
Expand Down Expand Up @@ -334,8 +334,14 @@ def _check_test_assertions(
assertions_valid = False
continue
signature = inspect.signature(function)
function_args = inspect.getfullargspec(function)
assertion_params = assertion_description["attributes"].copy()
if "verify_assertions_function" in function_args:
assertion_params["verify_assertions_function"] = asserts.verify_assertion(b"", [])
if "children" in function_args:
assertion_params["children"] = []
Comment on lines +339 to +342
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance you could add a test for that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I should do this.

del assertion_params["that"]

try:
# try mapping the function with the attributes supplied and check for TypeError
signature.bind("", **assertion_params)
Expand Down