+
Skip to content

Support modules with exec: blocks #3633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
### Modules

- Remove args stub from module template to satisfy language server ([#3403](https://github.com/nf-core/tools/pull/3403))
- Support modules with `exec:` blocks ([#3633](https://github.com/nf-core/tools/pull/3633))

### Subworkflows

Expand Down
12 changes: 10 additions & 2 deletions nf_core/modules/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def main_nf(
process_lines = []
script_lines = []
shell_lines = []
exec_lines = []
when_lines = []
iter_lines = iter(lines)
for line in iter_lines:
Expand All @@ -110,6 +111,9 @@ def main_nf(
if re.search(r"^\s*shell\s*:", line) and state in ["input", "output", "when", "process"]:
state = "shell"
continue
if re.search(r"^\s*exec\s*:", line) and state in ["input", "output", "when", "process"]:
state = "exec"
continue

# Perform state-specific linting checks
if state == "process" and not _is_empty(line):
Expand All @@ -132,6 +136,8 @@ def main_nf(
script_lines.append(line)
if state == "shell" and not _is_empty(line):
shell_lines.append(line)
if state == "exec" and not _is_empty(line):
exec_lines.append(line)

# Check that we have required sections
if not len(outputs):
Expand All @@ -149,8 +155,10 @@ def main_nf(
check_when_section(module, when_lines)

# Check that we have script or shell, not both
if len(script_lines) and len(shell_lines):
module.failed.append(("main_nf_script_shell", "Script and Shell found, should use only one", module.main_nf))
if sum(bool(block_lines) for block_lines in (script_lines, shell_lines, exec_lines)) > 1:
module.failed.append(
("main_nf_script_shell", "Multiple script:/shell:/exec: blocks found, should use only one", module.main_nf)
)

# Check the script definition
if len(script_lines):
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载