Skip to content

Commit

Permalink
lint type only if present
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Dec 15, 2020
1 parent 5c687a4 commit 4ce7cc4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
11 changes: 7 additions & 4 deletions planemo/shed_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("owner", validate_repo_owner)
_lint_if_present("name", validate_repo_name)
_lint_if_present("type", _validate_repo_type, config["name"])
_lint_if_present("categories", _validate_categories, realized_repository)
_lint("type", _validate_repo_type, config["name"])
_lint("categories", _validate_categories, realized_repository)


def _validate_repo_type(repo_type, name):
Expand Down
1 change: 0 additions & 1 deletion tests/data/repos/bad_invalid_tool_xml/.shed.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: cat
owner: iuc
description: cat1 tool
type: unrestricted
categories:
- Text Manipulation
1 change: 0 additions & 1 deletion tests/data/repos/multi_repos_nested/cat1/.shed.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: cat1
owner: iuc
description: cat1 tool
type: unrestricted
categories:
- Text Manipulation
1 change: 0 additions & 1 deletion tests/data/repos/multi_repos_nested/cat2/.shed.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: cat2
owner: iuc
description: cat2 tool
type: unrestricted
categories:
- Text Manipulation

0 comments on commit 4ce7cc4

Please sign in to comment.