From 02a2411e14cff3723bc3411ace9f1d629eadc993 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 15 Dec 2020 09:45:41 +0100 Subject: [PATCH 1/7] raise report level for some shed linting I think these are all cases which lead to errors in deploying. fixes https://github.com/galaxyproject/tools-iuc/issues/3384 --- planemo/shed_lint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/planemo/shed_lint.py b/planemo/shed_lint.py index b34a1e04e..da75faf8f 100644 --- a/planemo/shed_lint.py +++ b/planemo/shed_lint.py @@ -291,13 +291,13 @@ def lint_shed_yaml(realized_repository, lint_ctx): path = realized_repository.real_path shed_yaml = os.path.join(path, ".shed.yml") if not os.path.exists(shed_yaml): - lint_ctx.info("No .shed.yml file found, skipping.") + lint_ctx.error("No .shed.yml file found, skipping.") return try: with open(shed_yaml, "r") as fh: yaml.safe_load(fh) except Exception as e: - lint_ctx.warn("Failed to parse .shed.yml file [%s]" % unicodify(e)) + lint_ctx.error("Failed to parse .shed.yml file [%s]" % unicodify(e)) return lint_ctx.info(".shed.yml found and appears to be valid YAML.") _lint_shed_contents(lint_ctx, realized_repository) @@ -311,7 +311,9 @@ def _lint_if_present(key, func, *args): if value is not None: msg = func(value, *args) if msg: - lint_ctx.warn(msg) + lint_ctx.error(msg) + else: + lint_ctx.error("Repository does not define: %s" % key) _lint_if_present("owner", validate_repo_owner) _lint_if_present("name", validate_repo_name) From bc43d5992baf7d05bf60239803f6d8b0e1ce7975 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 15 Dec 2020 10:20:17 +0100 Subject: [PATCH 2/7] add .shed.yml to bad_invalid_tool_xml to make it pass shed_lint without --tool --- tests/data/repos/bad_invalid_tool_xml/.shed.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/data/repos/bad_invalid_tool_xml/.shed.yml diff --git a/tests/data/repos/bad_invalid_tool_xml/.shed.yml b/tests/data/repos/bad_invalid_tool_xml/.shed.yml new file mode 100644 index 000000000..c233e0fb5 --- /dev/null +++ b/tests/data/repos/bad_invalid_tool_xml/.shed.yml @@ -0,0 +1,5 @@ +name: cat +owner: iuc +description: cat1 tool +categories: +- Text Processing From 4db71af05620cc3d3d0a3a5b14e39dcbe5af9f88 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 15 Dec 2020 10:35:35 +0100 Subject: [PATCH 3/7] add shed.yml to multi_repos_nested --- tests/data/repos/multi_repos_nested/cat1/.shed.yml | 2 ++ tests/data/repos/multi_repos_nested/cat2/.shed.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/data/repos/multi_repos_nested/cat1/.shed.yml b/tests/data/repos/multi_repos_nested/cat1/.shed.yml index 4953b136e..c6d09bb85 100644 --- a/tests/data/repos/multi_repos_nested/cat1/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat1/.shed.yml @@ -1,3 +1,5 @@ name: cat1 owner: iuc description: cat1 tool +categories: +- Text Processing diff --git a/tests/data/repos/multi_repos_nested/cat2/.shed.yml b/tests/data/repos/multi_repos_nested/cat2/.shed.yml index a87f516a5..0e7a2d4c3 100644 --- a/tests/data/repos/multi_repos_nested/cat2/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat2/.shed.yml @@ -1,3 +1,5 @@ name: cat2 owner: iuc description: cat2 tool +categories: +- Text Processing From fb169b4eca65a52193aa5d4a918d60c729a0cfb9 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 15 Dec 2020 10:52:34 +0100 Subject: [PATCH 4/7] fix category --- tests/data/repos/bad_invalid_tool_xml/.shed.yml | 2 +- tests/data/repos/multi_repos_nested/cat1/.shed.yml | 2 +- tests/data/repos/multi_repos_nested/cat2/.shed.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/data/repos/bad_invalid_tool_xml/.shed.yml b/tests/data/repos/bad_invalid_tool_xml/.shed.yml index c233e0fb5..e439fa5f3 100644 --- a/tests/data/repos/bad_invalid_tool_xml/.shed.yml +++ b/tests/data/repos/bad_invalid_tool_xml/.shed.yml @@ -2,4 +2,4 @@ name: cat owner: iuc description: cat1 tool categories: -- Text Processing +- Text Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat1/.shed.yml b/tests/data/repos/multi_repos_nested/cat1/.shed.yml index c6d09bb85..3a2a1996d 100644 --- a/tests/data/repos/multi_repos_nested/cat1/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat1/.shed.yml @@ -2,4 +2,4 @@ name: cat1 owner: iuc description: cat1 tool categories: -- Text Processing +- Text Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat2/.shed.yml b/tests/data/repos/multi_repos_nested/cat2/.shed.yml index 0e7a2d4c3..f5e39e3c9 100644 --- a/tests/data/repos/multi_repos_nested/cat2/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat2/.shed.yml @@ -2,4 +2,4 @@ name: cat2 owner: iuc description: cat2 tool categories: -- Text Processing +- Text Manipulation From 5c687a422fcc08348f7ee82b38a6aabeef222ba6 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 15 Dec 2020 12:29:02 +0100 Subject: [PATCH 5/7] add type to shed.yml --- tests/data/repos/bad_invalid_tool_xml/.shed.yml | 1 + tests/data/repos/multi_repos_nested/cat1/.shed.yml | 1 + tests/data/repos/multi_repos_nested/cat2/.shed.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/data/repos/bad_invalid_tool_xml/.shed.yml b/tests/data/repos/bad_invalid_tool_xml/.shed.yml index e439fa5f3..478800f03 100644 --- a/tests/data/repos/bad_invalid_tool_xml/.shed.yml +++ b/tests/data/repos/bad_invalid_tool_xml/.shed.yml @@ -1,5 +1,6 @@ name: cat owner: iuc description: cat1 tool +type: unrestricted categories: - Text Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat1/.shed.yml b/tests/data/repos/multi_repos_nested/cat1/.shed.yml index 3a2a1996d..6311d7561 100644 --- a/tests/data/repos/multi_repos_nested/cat1/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat1/.shed.yml @@ -1,5 +1,6 @@ name: cat1 owner: iuc description: cat1 tool +type: unrestricted categories: - Text Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat2/.shed.yml b/tests/data/repos/multi_repos_nested/cat2/.shed.yml index f5e39e3c9..b244d92cd 100644 --- a/tests/data/repos/multi_repos_nested/cat2/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat2/.shed.yml @@ -1,5 +1,6 @@ name: cat2 owner: iuc description: cat2 tool +type: unrestricted categories: - Text Manipulation From cee8cfb222370a89aa2c55554f40957b31deb4af Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 15 Dec 2020 15:30:20 +0100 Subject: [PATCH 6/7] lint type only if present --- planemo/shed_lint.py | 11 +++++++---- tests/data/repos/bad_invalid_tool_xml/.shed.yml | 1 - tests/data/repos/multi_repos_nested/cat1/.shed.yml | 1 - tests/data/repos/multi_repos_nested/cat2/.shed.yml | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/planemo/shed_lint.py b/planemo/shed_lint.py index da75faf8f..d4ed88a78 100644 --- a/planemo/shed_lint.py +++ b/planemo/shed_lint.py @@ -312,13 +312,16 @@ def _lint_if_present(key, func, *args): msg = func(value, *args) if msg: lint_ctx.error(msg) - else: + return value + + def _lint(key, func, *args): + if _lint_if_present(key, func, *args) is None: lint_ctx.error("Repository does not define: %s" % key) - _lint_if_present("owner", validate_repo_owner) - _lint_if_present("name", validate_repo_name) + _lint("owner", validate_repo_owner) + _lint("name", validate_repo_name) _lint_if_present("type", _validate_repo_type, config["name"]) - _lint_if_present("categories", _validate_categories, realized_repository) + _lint("categories", _validate_categories, realized_repository) def _validate_repo_type(repo_type, name): diff --git a/tests/data/repos/bad_invalid_tool_xml/.shed.yml b/tests/data/repos/bad_invalid_tool_xml/.shed.yml index 478800f03..e439fa5f3 100644 --- a/tests/data/repos/bad_invalid_tool_xml/.shed.yml +++ b/tests/data/repos/bad_invalid_tool_xml/.shed.yml @@ -1,6 +1,5 @@ name: cat owner: iuc description: cat1 tool -type: unrestricted categories: - Text Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat1/.shed.yml b/tests/data/repos/multi_repos_nested/cat1/.shed.yml index 6311d7561..3a2a1996d 100644 --- a/tests/data/repos/multi_repos_nested/cat1/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat1/.shed.yml @@ -1,6 +1,5 @@ name: cat1 owner: iuc description: cat1 tool -type: unrestricted categories: - Text Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat2/.shed.yml b/tests/data/repos/multi_repos_nested/cat2/.shed.yml index b244d92cd..f5e39e3c9 100644 --- a/tests/data/repos/multi_repos_nested/cat2/.shed.yml +++ b/tests/data/repos/multi_repos_nested/cat2/.shed.yml @@ -1,6 +1,5 @@ name: cat2 owner: iuc description: cat2 tool -type: unrestricted categories: - Text Manipulation From c5602de280f7e3273b7e5a9b494fbb24cf8c1668 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 16 Dec 2020 10:34:41 +0100 Subject: [PATCH 7/7] skip shed.yml check only for unrestricted repos --- planemo/shed_lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planemo/shed_lint.py b/planemo/shed_lint.py index d4ed88a78..7517b4bc8 100644 --- a/planemo/shed_lint.py +++ b/planemo/shed_lint.py @@ -290,7 +290,7 @@ def lint_repository_dependencies(realized_repository, lint_ctx): def lint_shed_yaml(realized_repository, lint_ctx): path = realized_repository.real_path shed_yaml = os.path.join(path, ".shed.yml") - if not os.path.exists(shed_yaml): + if not os.path.exists(shed_yaml) and realized_repository.repository_type != REPO_TYPE_UNRESTRICTED: lint_ctx.error("No .shed.yml file found, skipping.") return try: