comparison env/lib/python3.9/site-packages/planemo/commands/cmd_lint.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 """Module describing the planemo ``lint`` command."""
2 import click
3
4 from planemo import options
5 from planemo.cli import command_function
6 from planemo.tool_lint import build_tool_lint_args, lint_tools_on_path
7
8
9 @click.command('lint')
10 @options.optional_tools_arg(multiple=True, allow_uris=True)
11 @options.report_level_option()
12 @options.report_xunit()
13 @options.fail_level_option()
14 @options.skip_option()
15 @options.lint_xsd_option()
16 @options.recursive_option()
17 @click.option(
18 "--urls",
19 is_flag=True,
20 default=False,
21 help="Check validity of URLs in XML files",
22 )
23 @click.option(
24 "--doi",
25 is_flag=True,
26 default=False,
27 help="Check validity of DOIs in XML files",
28 )
29 @click.option(
30 "--conda_requirements",
31 is_flag=True,
32 default=False,
33 help="Check tool requirements for availability in best practice Conda channels.",
34 )
35 @click.option(
36 "biocontainer",
37 "--biocontainer",
38 "--biocontainers",
39 is_flag=True,
40 default=False,
41 help="Check best practice BioContainer namespaces for a container definition applicable for this tool.",
42 )
43 # @click.option(
44 # "--verify",
45 # is_flag=True,
46 # help="If an sha256sum is available, download the entire file AND validate it.",
47 # default=False,
48 # )
49 @command_function
50 def cli(ctx, uris, **kwds):
51 """Check for common errors and best practices."""
52 lint_args = build_tool_lint_args(ctx, **kwds)
53 exit_code = lint_tools_on_path(
54 ctx,
55 uris,
56 lint_args,
57 recursive=kwds["recursive"]
58 )
59
60 # TODO: rearchitect XUnit.
61 # if kwds['urls']:
62 # collected_data, url_exit_code = check_urls(ctx, paths, **kwds)
63 # if kwds.get('report_xunit', False):
64 # with open(kwds['report_xunit'], 'w') as handle:
65 # handle.write(build_report.template_data(
66 # collected_data, template_name='xunit.tpl'))
67 ctx.exit(exit_code)