Mercurial > repos > shellac > guppy_basecaller
diff env/lib/python3.7/site-packages/planemo/tool_lint.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author | shellac |
---|---|
date | Mon, 01 Jun 2020 08:59:25 -0400 |
parents | 79f47841a781 |
children |
line wrap: on
line diff
--- a/env/lib/python3.7/site-packages/planemo/tool_lint.py Thu May 14 16:47:39 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -from __future__ import absolute_import - -from os.path import basename - -from galaxy.tool_util.lint import lint_tool_source - -from planemo.exit_codes import ( - EXIT_CODE_GENERIC_FAILURE, - EXIT_CODE_OK, -) -from planemo.io import ( - coalesce_return_codes, - error, - info, -) -from planemo.tools import ( - is_tool_load_error, - yield_tool_sources_on_paths, -) - -LINTING_TOOL_MESSAGE = "Linting tool %s" - - -def lint_tools_on_path(ctx, paths, lint_args, **kwds): - assert_tools = kwds.get("assert_tools", True) - recursive = kwds.get("recursive", False) - exit_codes = [] - for (tool_path, tool_xml) in yield_tool_sources_on_paths(ctx, paths, recursive): - if handle_tool_load_error(tool_path, tool_xml): - exit_codes.append(EXIT_CODE_GENERIC_FAILURE) - continue - info("Linting tool %s" % tool_path) - if not lint_tool_source(tool_xml, name=basename(tool_path), **lint_args): - error("Failed linting") - exit_codes.append(EXIT_CODE_GENERIC_FAILURE) - else: - exit_codes.append(EXIT_CODE_OK) - return coalesce_return_codes(exit_codes, assert_at_least_one=assert_tools) - - -def handle_tool_load_error(tool_path, tool_xml): - """ Return True if tool_xml is tool load error (invalid XML), and - print a helpful error message. - """ - is_error = False - if is_tool_load_error(tool_xml): - info("Could not lint %s due to malformed xml." % tool_path) - is_error = True - return is_error