Loading lib/galaxy/tool_util/linters/datatypes.py +10 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,16 @@ class ValidDatatypes(Linter): for attrib in ["format", "ftype", "ext"]: for elem in tool_xml.findall(f".//*[@{attrib}]"): formats = elem.get(attrib, "").split(",") # Certain elements (e.g. `data`) can only have one format. This # is checked separately by linting against the XSD. if "auto" in formats: if elem.tag == "param": lint_ctx.error( "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( Loading test/unit/tool_util/test_tool_linters.py +5 −1 Original line number Diff line number Diff line Loading @@ -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"/> Loading @@ -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> Loading Loading @@ -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"> Loading Loading
lib/galaxy/tool_util/linters/datatypes.py +10 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,16 @@ class ValidDatatypes(Linter): for attrib in ["format", "ftype", "ext"]: for elem in tool_xml.findall(f".//*[@{attrib}]"): formats = elem.get(attrib, "").split(",") # Certain elements (e.g. `data`) can only have one format. This # is checked separately by linting against the XSD. if "auto" in formats: if elem.tag == "param": lint_ctx.error( "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( Loading
test/unit/tool_util/test_tool_linters.py +5 −1 Original line number Diff line number Diff line Loading @@ -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"/> Loading @@ -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> Loading Loading @@ -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"> Loading