diff --git a/planemo/shed_lint.py b/planemo/shed_lint.py index b34a1e04e..7517b4bc8 100644 --- a/planemo/shed_lint.py +++ b/planemo/shed_lint.py @@ -290,14 +290,14 @@ 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): - lint_ctx.info("No .shed.yml file found, skipping.") + 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: 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,12 +311,17 @@ 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) + return value - _lint_if_present("owner", validate_repo_owner) - _lint_if_present("name", validate_repo_name) + def _lint(key, func, *args): + if _lint_if_present(key, func, *args) is None: + lint_ctx.error("Repository does not define: %s" % key) + + _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 new file mode 100644 index 000000000..e439fa5f3 --- /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 Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat1/.shed.yml b/tests/data/repos/multi_repos_nested/cat1/.shed.yml index 4953b136e..3a2a1996d 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 Manipulation diff --git a/tests/data/repos/multi_repos_nested/cat2/.shed.yml b/tests/data/repos/multi_repos_nested/cat2/.shed.yml index a87f516a5..f5e39e3c9 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 Manipulation