Skip to content

Commit

Permalink
Merge pull request #2121 from mirpedrol/dev
Browse files Browse the repository at this point in the history
allow specifying only one container
  • Loading branch information
mirpedrol authored Dec 12, 2022
2 parents 94a03a1 + a85b896 commit bc44d2e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Linting

- Allow specifying containers in less than three lines ([#2121](https://github.com/nf-core/tools/pull/2121))

### Modules

### Subworkflows
Expand Down
26 changes: 24 additions & 2 deletions nf_core/modules/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ def check_process_section(self, lines, fix_version, progress_bar):
self.failed.append(("singularity_tag", "Unable to parse singularity tag", self.main_nf))
singularity_tag = None
url = urlparse(l.split("'")[0])
# lint double quotes
if l.count('"') > 2:
self.failed.append(
(
"container_links",
"Too many double quotes found when specifying singularity container",
self.main_nf,
)
)
if _container_type(l) == "docker":
# e.g. "quay.io/biocontainers/krona:2.7.1--pl526_5' }" -> 2.7.1--pl526_5
# e.g. "biocontainers/biocontainers:v1.2.0_cv1' }" -> v1.2.0_cv1
Expand All @@ -282,13 +291,26 @@ def check_process_section(self, lines, fix_version, progress_bar):
self.failed.append(("docker_tag", "Unable to parse docker tag", self.main_nf))
docker_tag = None
url = urlparse(l.split("'")[0])
# lint double quotes
if l.count('"') > 2:
self.failed.append(
("container_links", "Too many double quotes found when specifying docker container", self.main_nf)
)
# lint double quotes
if l.startswith("container"):
container_section = l + lines[i + 1] + lines[i + 2]
if container_section.count('"') > 2:
if l.count('"') > 2:
self.failed.append(
("container_links", "Too many double quotes found when specifying containers", self.main_nf)
)
# lint more than one container in the same line
if ("https://containers" in l or "https://depot" in l) and ("biocontainers/" in l or "quay.io/" in l):
self.warned.append(
(
"container_links",
"Docker and Singularity containers specified in the same line. Only first one checked.",
self.main_nf,
)
)
# Try to connect to container URLs
if url is None:
continue
Expand Down

0 comments on commit bc44d2e

Please sign in to comment.