comparison env/lib/python3.7/site-packages/planemo/commands/cmd_lint.py @ 0:26e78fe6e8c4 draft

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