From 8044da8ad5295806eb474e5c1fab8522a64caa99 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Mon, 1 Jul 2024 19:13:40 +0200 Subject: [PATCH] check lint skip types only for tool linting --- planemo/commands/cmd_lint.py | 9 +++++++++ planemo/lint.py | 10 +--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/planemo/commands/cmd_lint.py b/planemo/commands/cmd_lint.py index 85a3c77cc..736e6d78a 100644 --- a/planemo/commands/cmd_lint.py +++ b/planemo/commands/cmd_lint.py @@ -4,11 +4,14 @@ from planemo import options from planemo.cli import command_function +from planemo.io import error from planemo.tool_lint import ( build_tool_lint_args, lint_tools_on_path, ) +from galaxy.tool_util.lint import Linter + @click.command("lint") @options.optional_tools_arg(multiple=True, allow_uris=True) @@ -46,6 +49,12 @@ def cli(ctx, uris, **kwds): """Check for common errors and best practices.""" lint_args = build_tool_lint_args(ctx, **kwds) + + linters = Linter.list_linters() + invalid_skip_types = list(set(lint_args["skip_types"]) - set(linters)) + if len(invalid_skip_types): + error(f"Unknown linter type(s) {invalid_skip_types} in list of linters to be skipped. Known linters {linters}") + exit_code = lint_tools_on_path(ctx, uris, lint_args, recursive=kwds["recursive"]) # TODO: rearchitect XUnit. diff --git a/planemo/lint.py b/planemo/lint.py index c14247e7a..618bb61ed 100644 --- a/planemo/lint.py +++ b/planemo/lint.py @@ -4,10 +4,7 @@ from urllib.request import urlopen import requests -from galaxy.tool_util.lint import ( - LintContext, - Linter, -) +from galaxy.tool_util.lint import LintContext from planemo.io import error from planemo.shed import find_urls_for_xml @@ -34,11 +31,6 @@ def build_lint_args(ctx, **kwds): continue skip_types.append(line) - linters = Linter.list_linters() - invalid_skip_types = list(set(skip_types) - set(linters)) - if len(invalid_skip_types): - error(f"Unknown linter type(s) {invalid_skip_types} in list of linters to be skipped. Known linters {linters}") - lint_args = dict( level=report_level, fail_level=fail_level,