From ec2eeb05a005ed84acd99fd7664b9af3f2e4ca89 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Mon, 14 Mar 2022 14:31:39 +0100 Subject: [PATCH] Prevent module linting KeyError edge case. Fixes #1321 --- CHANGELOG.md | 1 + nf_core/modules/lint/main_nf.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d6543a51c..2676065684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ * Call the command line help with `-h` as well as `--help` (was formerly just the latter) ([#1404](https://github.com/nf-core/tools/pull/1404)) * Add `.yamllint.yml` config file to avoid line length and document start errors in the tools repo itself. * Switch to `yamllint-github-action`to be able to configure yaml lint exceptions ([#1404](https://github.com/nf-core/tools/issues/1413)) +* Prevent module linting KeyError edge case ([#1321](https://github.com/nf-core/tools/issues/1321)) ### Modules diff --git a/nf_core/modules/lint/main_nf.py b/nf_core/modules/lint/main_nf.py index 9f27f94f2c..80fe8fbf9e 100644 --- a/nf_core/modules/lint/main_nf.py +++ b/nf_core/modules/lint/main_nf.py @@ -276,9 +276,9 @@ def _parse_output(self, line): output = [] if "meta" in line: output.append("meta") - if not "emit" in line: + if not "emit:" in line: self.failed.append(("missing_emit", f"Missing emit statement: {line.strip()}", self.main_nf)) - if "emit" in line: + else: output.append(line.split("emit:")[1].strip()) return output