Skip to content
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

Fix module section linter regex #3321

Merged
merged 6 commits into from
Dec 6, 2024
Merged
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 @@ -25,6 +25,7 @@
### Linting

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

### Modules

Expand Down
10 changes: 5 additions & 5 deletions nf_core/modules/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ def main_nf(
for line in iter_lines:
if re.search(r"^\s*process\s*\w*\s*{", line) and state == "module":
state = "process"
if re.search(r"input\s*:", line) and state in ["process"]:
if re.search(r"^\s*input\s*:", line) and state in ["process"]:
state = "input"
continue
if re.search(r"output\s*:", line) and state in ["input", "process"]:
if re.search(r"^\s*output\s*:", line) and state in ["input", "process"]:
state = "output"
continue
if re.search(r"when\s*:", line) and state in ["input", "output", "process"]:
if re.search(r"^\s*when\s*:", line) and state in ["input", "output", "process"]:
state = "when"
continue
if re.search(r"script\s*:", line) and state in ["input", "output", "when", "process"]:
if re.search(r"^\s*script\s*:", line) and state in ["input", "output", "when", "process"]:
state = "script"
continue
if re.search(r"shell\s*:", line) and state in ["input", "output", "when", "process"]:
if re.search(r"^\s*shell\s*:", line) and state in ["input", "output", "when", "process"]:
state = "shell"
continue

Expand Down
Loading