Skip to content

Commit 813dbf2

Browse files
authored
Merge pull request #3830 from mashehu/fix-ternary-containter-linting
fix ternary container linting
2 parents a5411fa + 245bbdc commit 813dbf2

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Use the org from .nf-core.yml when linting multiqc_config report_comment ([#3800](https://github.com/nf-core/tools/pull/3800))
2828
- Linting of patched subworkflows ([#3755](https://github.com/nf-core/tools/pull/3755))
2929
- Add link to modules and subworkflows linting error docs ([#3818](https://github.com/nf-core/tools/pull/3818))
30+
- fix ternary container linting ([#3830](https://github.com/nf-core/tools/pull/3830))
3031

3132
### Modules
3233

nf_core/modules/lint/main_nf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,11 @@ def check_process_section(self, lines, registry, fix_version, progress_bar):
314314
# Deprecated enable_conda
315315
for i, raw_line in enumerate(lines):
316316
url = None
317-
line = raw_line.strip(" \n'\"}:")
317+
line = raw_line.strip(" \n'\"}:?")
318318

319319
# Catch preceding "container "
320320
if line.startswith("container"):
321-
line = line.replace("container", "").strip(" \n'\"}:")
321+
line = line.replace("container", "").strip(" \n'\"}:?")
322322

323323
if _container_type(line) == "conda":
324324
if "bioconda::" in line:
@@ -592,7 +592,7 @@ def check_process_labels(self, lines):
592592
def check_container_link_line(self, raw_line, registry):
593593
"""Look for common problems in the container name / URL, for docker and singularity."""
594594

595-
line = raw_line.strip(" \n'\"}:")
595+
line = raw_line.strip(" \n'\"}:?")
596596

597597
# lint double quotes
598598
if line.count('"') > 2:

tests/modules/lint/test_main_nf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ def test_process_labels(content, passed, warned, failed):
7171
0,
7272
1,
7373
),
74+
# Ternary with ? on next line (new Nextflow format) should pass
75+
(
76+
'''container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
77+
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/c2/c262fc09eca59edb5a724080eeceb00fb06396f510aefb229c2d2c6897e63975/data'
78+
: 'community.wave.seqera.io/library/coreutils:9.5--ae99c88a9b28c264'}"''',
79+
6,
80+
0,
81+
0,
82+
),
7483
],
7584
)
7685
def test_container_links(content, passed, warned, failed):

0 commit comments

Comments
 (0)