diff --git a/lib/galaxy/tool_util/linters/outputs.py b/lib/galaxy/tool_util/linters/outputs.py index 8232cbab891f..e3de862b8836 100644 --- a/lib/galaxy/tool_util/linters/outputs.py +++ b/lib/galaxy/tool_util/linters/outputs.py @@ -45,7 +45,14 @@ def lint_output(tool_xml, lint_ctx): label = output.attrib.get("label", "${tool.name} on ${on_string}") if label in labels: - lint_ctx.error(f"Tool output [{name}] uses duplicated label '{label}'", node=output) + filter_node = output.find(".//filter") + if filter_node is not None: + lint_ctx.warn( + f"Tool output [{name}] uses duplicated label '{label}', double check if filters imply disjoint cases", + node=output, + ) + else: + lint_ctx.warn(f"Tool output [{name}] uses duplicated label '{label}'", node=output) labels.add(label) format_set = False diff --git a/test/unit/tool_util/test_tool_linters.py b/test/unit/tool_util/test_tool_linters.py index f2b2db004df0..e9ea77589cfd 100644 --- a/test/unit/tool_util/test_tool_linters.py +++ b/test/unit/tool_util/test_tool_linters.py @@ -566,6 +566,12 @@ + + a condition + + + another condition + """ @@ -1492,13 +1498,17 @@ def test_outputs_discover_tool_provided_metadata(lint_ctx): def test_outputs_duplicated_name_label(lint_ctx): tool_source = get_xml_tool_source(OUTPUTS_DUPLICATED_NAME_LABEL) run_lint(lint_ctx, outputs.lint_output, tool_source) - assert "2 outputs found." in lint_ctx.info_messages + assert "4 outputs found." in lint_ctx.info_messages assert len(lint_ctx.info_messages) == 1 assert not lint_ctx.valid_messages - assert not lint_ctx.warn_messages + assert len(lint_ctx.warn_messages) == 2 + assert "Tool output [valid_name] uses duplicated label '${tool.name} on ${on_string}'" in lint_ctx.warn_messages + assert ( + "Tool output [yet_another_valid_name] uses duplicated label 'same label may be OK if there is a filter', double check if filters imply disjoint cases" + in lint_ctx.warn_messages + ) assert "Tool output [valid_name] has duplicated name" in lint_ctx.error_messages - assert "Tool output [valid_name] uses duplicated label '${tool.name} on ${on_string}'" in lint_ctx.error_messages - assert len(lint_ctx.error_messages) == 2 + assert len(lint_ctx.error_messages) == 1 def test_stdio_default_for_default_profile(lint_ctx):