Skip to content

Commit

Permalink
Module linting: recognise 'shell' block.
Browse files Browse the repository at this point in the history
Means that we properly exit out of the 'when' block when 'shell' is used instead of 'script'.

Fixes nf-core#1557
  • Loading branch information
ewels committed May 12, 2022
1 parent 5d4488f commit 479a71d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Escaped test run output before logging it, to avoid a rich ` MarkupError`
- Add a new command `nf-core modules mulled` which can generate the name for a multi-tool container image.
- Add a new command `nf-core modules test` which runs pytests locally.
- Linting now recognised `shell` blocks to avoid error `when: condition has too many lines` ([#1557](https://github.com/nf-core/tools/issues/1557))

## [v2.3.2 - Mercury Vulture Fixed Formatting](https://github.com/nf-core/tools/releases/tag/2.3.2) - [2022-03-24]

Expand Down
3 changes: 3 additions & 0 deletions nf_core/modules/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def main_nf(module_lint_object, module):
if re.search("script\s*:", l) and state in ["input", "output", "when", "process"]:
state = "script"
continue
if re.search("shell\s*:", l) and state in ["input", "output", "when", "process"]:
state = "shell"
continue

# Perform state-specific linting checks
if state == "process" and not _is_empty(module, l):
Expand Down

0 comments on commit 479a71d

Please sign in to comment.