Skip to content

Commit

Permalink
fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Sep 8, 2023
1 parent c127410 commit 459afe9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
8 changes: 5 additions & 3 deletions snakemake/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,17 @@ def lint(self, json: bool = False):
Arguments
---------
json: bool -- Whether to print the linting results as JSON.
"""
from snakemake.workflow import Workflow
Returns
-------
True if any lints were printed
"""
workflow = self._get_workflow(check_envvars=False)
workflow.include(
self.snakefile, overwrite_default_target=True, print_compilation=False
)
workflow.check()
workflow.lint(json=json)
return workflow.lint(json=json)

def generate_unit_tests(self, path: Path):
"""Generate unit tests for the workflow.
Expand Down
7 changes: 5 additions & 2 deletions snakemake/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def get_argument_parser(profiles=None):
"--directory",
"-d",
metavar="DIR",
action="store",
type=Path,
help=(
"Specify working directory (relative paths in "
"the snakefile will use this as their origin)."
Expand Down Expand Up @@ -1943,7 +1943,10 @@ def args_to_api(args, parser):
)

if args.lint:
workflow_api.lint()
any_lint = workflow_api.lint()
if any_lint:
# trigger exit code 1
return False
elif args.generate_unit_tests:
workflow_api.generate_unit_tests(args.generate_unit_tests)
elif args.list_target_rules:
Expand Down
9 changes: 0 additions & 9 deletions snakemake/linting/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ def lint_not_used_params(
links=[links.params],
)

def lint_version(self, rule):
if rule.version:
yield Lint(
title="The version directive is deprecated",
body="It was meant for documenting tool version, but this has been replaced "
"by using the conda or container directive.",
links=[links.package_management, links.containers],
)

def lint_dynamic(self, rule):
for file in chain(rule.output, rule.input):
if is_flagged(file, "dynamic"):
Expand Down
2 changes: 1 addition & 1 deletion snakemake/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, workflow, executor_plugin: ExecutorPlugin):
)
self._local_executor = (
ExecutorPluginRegistry()
.get("local")
.get_plugin("local")
.executor(
self.workflow,
logger,
Expand Down

0 comments on commit 459afe9

Please sign in to comment.