mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Merge pull request #13583 from bernt-matthias/lint-ftype-action
[22.01] linter: allow setting output format with actions
This commit is contained in:
@@ -63,6 +63,8 @@ def __check_format(node, lint_ctx, allow_ext=False):
|
||||
lint_ctx.warn(f"Tool {node.tag} output '{node.attrib.get('name', 'with missing name')}' should use either format_source or format/ext", node=node)
|
||||
if "format_source" in node.attrib:
|
||||
return True
|
||||
if node.find(".//action[@type='format']") is not None:
|
||||
return True
|
||||
# if allowed (e.g. for discover_datasets), ext takes precedence over format
|
||||
fmt = None
|
||||
if allow_ext:
|
||||
|
||||
@@ -442,6 +442,25 @@ OUTPUTS_COLLECTION_FORMAT_SOURCE = """
|
||||
</tool>
|
||||
"""
|
||||
|
||||
# check that setting format with actions is supported
|
||||
OUTPUTS_FORMAT_ACTION = """
|
||||
<tool>
|
||||
<outputs>
|
||||
<data name="output">
|
||||
<actions>
|
||||
<conditional name="library.type">
|
||||
<when value="paired">
|
||||
<action type="format">
|
||||
<option type="from_param" name="library.input_2" param_attribute="ext" />
|
||||
</action>
|
||||
</when>
|
||||
</conditional>
|
||||
</actions>
|
||||
</data>
|
||||
</outputs>
|
||||
</tool>
|
||||
"""
|
||||
|
||||
# check that linter does not complain about missing format if from_tool_provided_metadata is used
|
||||
OUTPUTS_DISCOVER_TOOL_PROVIDED_METADATA = """
|
||||
<tool>
|
||||
@@ -1102,6 +1121,15 @@ def test_outputs_collection_format_source(lint_ctx):
|
||||
assert not lint_ctx.error_messages
|
||||
|
||||
|
||||
def test_outputs_format_action(lint_ctx):
|
||||
tool_source = get_xml_tool_source(OUTPUTS_FORMAT_ACTION)
|
||||
run_lint(lint_ctx, outputs.lint_output, tool_source)
|
||||
assert len(lint_ctx.info_messages) == 1
|
||||
assert not lint_ctx.valid_messages
|
||||
assert not lint_ctx.warn_messages
|
||||
assert not lint_ctx.error_messages
|
||||
|
||||
|
||||
def test_outputs_discover_tool_provided_metadata(lint_ctx):
|
||||
tool_source = get_xml_tool_source(OUTPUTS_DISCOVER_TOOL_PROVIDED_METADATA)
|
||||
run_lint(lint_ctx, outputs.lint_output, tool_source)
|
||||
|
||||
Reference in New Issue
Block a user