Skip to content

Commit b2132cf

Browse files
authored
Merge pull request #3321 from lmReef/fix-module-section-regex
2 parents 0ba1c70 + af05e4a commit b2132cf

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
### Linting
2626

2727
- allow mixed `str` and `dict` entries in lint config ([#3228](https://github.com/nf-core/tools/pull/3228))
28+
- fix module section regex matching wrong things ([#3321](https://github.com/nf-core/tools/pull/3321))
2829

2930
### Modules
3031

nf_core/modules/lint/main_nf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ def main_nf(
9696
for line in iter_lines:
9797
if re.search(r"^\s*process\s*\w*\s*{", line) and state == "module":
9898
state = "process"
99-
if re.search(r"input\s*:", line) and state in ["process"]:
99+
if re.search(r"^\s*input\s*:", line) and state in ["process"]:
100100
state = "input"
101101
continue
102-
if re.search(r"output\s*:", line) and state in ["input", "process"]:
102+
if re.search(r"^\s*output\s*:", line) and state in ["input", "process"]:
103103
state = "output"
104104
continue
105-
if re.search(r"when\s*:", line) and state in ["input", "output", "process"]:
105+
if re.search(r"^\s*when\s*:", line) and state in ["input", "output", "process"]:
106106
state = "when"
107107
continue
108-
if re.search(r"script\s*:", line) and state in ["input", "output", "when", "process"]:
108+
if re.search(r"^\s*script\s*:", line) and state in ["input", "output", "when", "process"]:
109109
state = "script"
110110
continue
111-
if re.search(r"shell\s*:", line) and state in ["input", "output", "when", "process"]:
111+
if re.search(r"^\s*shell\s*:", line) and state in ["input", "output", "when", "process"]:
112112
state = "shell"
113113
continue
114114

0 commit comments

Comments
 (0)