Commit 9f86a7db authored by Matthias Bernt's avatar Matthias Bernt
Browse files

linter allow datatype auto in output tags

parent a209a8b9
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -78,6 +78,14 @@ class ValidDatatypes(Linter):
        for attrib in ["format", "ftype", "ext"]:
            for elem in tool_xml.findall(f".//*[@{attrib}]"):
                formats = elem.get(attrib, "").split(",")
                if "auto" in formats:
                    if elem.tag == "param":
                        lint_ctx.error(
                            f"Format [auto] can not be used for tool or tool test inputs",
                            linter=cls.name(),
                            node=elem,
                        )
                    continue
                for format in formats:
                    if format not in datatypes:
                        lint_ctx.error(
+5 −1
Original line number Diff line number Diff line
@@ -2029,8 +2029,10 @@ VALID_DATATYPES = """
        <param name="adata" type="data" format="txt"/>
        <param name="bdata" type="data" format="invalid,fasta,custom"/>
        <param name="fdata" type="data" format="fasta.gz"/>
        <param name="auto_input" type="data" format="auto"/>
    </inputs>
    <outputs>
        <data name="autoformat" format="auto"/>
        <data name="name" format="another_invalid">
            <change_format>
                <when input="input_text" value="foo" format="just_another_invalid"/>
@@ -2045,6 +2047,7 @@ VALID_DATATYPES = """
        <test>
            <param name="adata" ftype="txt"/>
            <param name="bdata" ftype="invalid"/>
            <param name="auto_test_input" ftype="auto"/>
        </test>
    </tests>
</tool>
@@ -2082,7 +2085,8 @@ def test_valid_datatypes(lint_ctx):
    assert "Unknown datatype [collection_format] used in collection" in lint_ctx.error_messages
    assert "Unknown datatype [invalid] used in param" in lint_ctx.error_messages
    assert "Unknown datatype [invalid] used in discover_datasets" in lint_ctx.error_messages
    assert len(lint_ctx.error_messages) == 6
    assert "Format [auto] can not be used for tool or tool test inputs" in lint_ctx.error_messages  # 2x
    assert len(lint_ctx.error_messages) == 8


DATA_MANAGER = """<tool id="test_dm" name="test dm" version="1" tool_type="manage_data">