From 3140daf4050ed6096304a4185bda01054f401043 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 23 Dec 2022 09:54:52 +0100 Subject: [PATCH 1/3] also lint data managers so far only the general linter was applied to data managers. I see no reason why the other linters that run on tools should not run on data managers --- lib/galaxy/tool_util/lint.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index b6aad2a839e..ea06dd8743a 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -46,6 +46,7 @@ In order to use this. import inspect from enum import IntEnum +import logging from typing import ( Callable, List, @@ -61,6 +62,8 @@ from galaxy.util import ( submodules, ) +log = logging.getLogger(__name__) + class LintLevel(IntEnum): SILENT = 5 @@ -323,7 +326,7 @@ def lint_tool_source_with(lint_context, tool_source, extra_modules=None) -> Lint linter_modules = submodules.import_submodules(galaxy.tool_util.linters) linter_modules.extend(extra_modules) for module in linter_modules: - lint_tool_types = getattr(module, "lint_tool_types", ["default"]) + lint_tool_types = getattr(module, "lint_tool_types", ["default", "manage_data"]) if not ("*" in lint_tool_types or tool_type in lint_tool_types): continue From 598521f496363a733db1704242e9ebc6e5061a5e Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 23 Dec 2022 10:15:28 +0100 Subject: [PATCH 2/3] add test --- test/unit/tool_util/test_tool_linters.py | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/unit/tool_util/test_tool_linters.py b/test/unit/tool_util/test_tool_linters.py index 34617ed048e..c8909084c11 100644 --- a/test/unit/tool_util/test_tool_linters.py +++ b/test/unit/tool_util/test_tool_linters.py @@ -1619,6 +1619,37 @@ def test_xml_order(lint_ctx): assert not lint_ctx.error_messages +DATA_MANAGER = """ + + + + + + + +""" + + +def test_data_manager(lint_ctx_xpath, lint_ctx): + """ + test that all (not really testing 'all', but more than the general linter + which was the only one applied to data managers until 23.0) linters are applied + """ + tool_xml = get_xml_tool_source(DATA_MANAGER) + tool_source = XmlToolSource(tool_xml) + lint_tool_source_with(lint_ctx, tool_source) + assert "No tests found, most tools should define test cases." in lint_ctx.warn_messages + assert "Tool contains no outputs section, most tools should produce outputs." in lint_ctx.warn_messages + assert "No help section found, consider adding a help section to your tool." in lint_ctx.warn_messages + assert "No citations found, consider adding citations to your tool." in lint_ctx.warn_messages + assert "Select parameter [select] has multiple options with the same text content" in lint_ctx.error_messages + assert "Select parameter [select] has multiple options with the same value" in lint_ctx.error_messages + assert "No command tag found, must specify a command template to execute." in lint_ctx.error_messages + assert lint_ctx.valid_messages + assert len(lint_ctx.warn_messages) == 4 + assert len(lint_ctx.error_messages) == 3 + + COMPLETE = """ macros.xml From 2e433e378ac46073c5e341e42e8b8a22c6186c7a Mon Sep 17 00:00:00 2001 From: M Bernt Date: Mon, 26 Dec 2022 11:01:19 +0100 Subject: [PATCH 3/3] Remove logging code --- lib/galaxy/tool_util/lint.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index ea06dd8743a..c8852d5eb9c 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -46,7 +46,6 @@ In order to use this. import inspect from enum import IntEnum -import logging from typing import ( Callable, List, @@ -62,8 +61,6 @@ from galaxy.util import ( submodules, ) -log = logging.getLogger(__name__) - class LintLevel(IntEnum): SILENT = 5