Skip to content

Commit

Permalink
Update linting for newer detect_errors attribute.
Browse files Browse the repository at this point in the history
Fixes #233.
  • Loading branch information
jmchilton committed Jun 20, 2015
1 parent 2863ad0 commit 3340728
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 14 additions & 1 deletion planemo_ext/galaxy/tools/linters/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def lint_command(tool_xml, lint_ctx):
lint_ctx.error("No command tag found, must specify a command template to execute.")
return

command = commands[0]
command = get_command(tool_xml)
if "TODO" in command:
lint_ctx.warn("Command template contains TODO text.")

Expand All @@ -20,10 +20,23 @@ def lint_command(tool_xml, lint_ctx):
for key, value in command_attrib.items():
if key == "interpreter":
interpreter_type = value
elif key == "detect_errors":
detect_errors = value
if detect_errors not in ["default", "exit_code", "aggressive"]:
lint_ctx.warn("Unknown detect_errors attribute [%s]" % detect_errors)
else:
lint_ctx.warn("Unknown attribute [%s] encountered on command tag." % key)

interpreter_info = ""
if interpreter_type:
interpreter_info = " with interpreter of type [%s]" % interpreter_type
lint_ctx.info("Tool contains a command%s." % interpreter_info)


def get_command(tool_xml):
root = tool_xml.getroot()
commands = root.findall("command")
command = None
if len(commands) == 1:
command = commands[0]
return command
5 changes: 4 additions & 1 deletion planemo_ext/galaxy/tools/linters/stdio.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from .command import get_command


def lint_stdio(tool_xml, lint_ctx):
stdios = tool_xml.findall("./stdio")
if not stdios:
lint_ctx.info("No stdio definition found, tool will determine an error from stderr.")
command = get_command(tool_xml)
if command is None or not command.get("detect_errors"):
lint_ctx.info("No stdio definition found, tool will determine an error from stderr.")
return

if len(stdios) > 1:
Expand Down

0 comments on commit 3340728

Please sign in to comment.