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

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/env/lib/python3.9/site-packages/planemo/commands/cmd_shed_lint.py	Mon Mar 22 18:12:50 2021 +0000
@@ -0,0 +1,59 @@
+"""Module describing the planemo ``shed_lint`` command."""
+import click
+
+from planemo import options
+from planemo import shed
+from planemo import shed_lint
+from planemo.cli import command_function
+
+
+@click.command('shed_lint')
+@options.shed_realization_options()
+@options.report_level_option()
+@options.fail_level_option()
+@options.click.option(
+    '--tools',
+    is_flag=True,
+    default=False,
+    help=("Lint tools discovered in the process of linting repositories.")
+)
+@options.lint_xsd_option()
+@options.click.option(
+    '--ensure_metadata',
+    is_flag=True,
+    default=False,
+    help=("Ensure .shed.yml files contain enough metadata for each repository "
+          "to allow automated creation and/or updates.")
+)
+@click.option(
+    "--urls",
+    is_flag=True,
+    default=False,
+    help="Check validity of URLs in XML files",
+)
+# @click.option(
+#     "--verify",
+#     is_flag=True,
+#     help="If an sha256sum is available, download the entire file AND validate it.",
+#     default=False,
+# )
+@command_function
+def cli(ctx, paths, **kwds):
+    """Check Tool Shed repository for common issues.
+
+    With the ``--tools`` flag, this command lints actual Galaxy tools
+    in addition to tool shed artifacts.
+
+    With the ``--urls`` flag, this command searches for
+    ``<package>$URL</package>`` and download actions which specify URLs. Each
+    of those are accessed individually. By default, this tool requests the
+    first hundred or so bytes of each listed URL and validates that a 200 OK
+    was received. In tool XML files, the ``--urls`` option checks through the
+    help text for mentioned URLs and checks those.
+    """
+    def lint(realized_repository):
+        return shed_lint.lint_repository(ctx, realized_repository, **kwds)
+
+    kwds["fail_on_missing"] = False
+    exit_code = shed.for_each_repository(ctx, lint, paths, **kwds)
+    ctx.exit(exit_code)