Skip to content

Commit d2f9ce7

Browse files
authored
Merge pull request #1871 from nf-core/dev
Dev > Master for v2.6 release
2 parents 0d23e9a + 3a5cbc5 commit d2f9ce7

22 files changed

Lines changed: 149 additions & 17 deletions

.github/workflows/rich-codex.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ jobs:
2424
uses: ewels/rich-codex@v1
2525
env:
2626
COLUMNS: 100
27-
NFCORE_LINT_HIDE_PROGRESS: true
28-
NFCORE_MODULES_LINT_HIDE_PROGRESS: true
27+
HIDE_PROGRESS: "true"
2928
with:
3029
commit_changes: "true"
3130
clean_img_paths: docs/images/*.svg
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# module_changes
2+
3+
```{eval-rst}
4+
.. automethod:: nf_core.modules.lint.ModuleLint.module_changes
5+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# module_patch
2+
3+
```{eval-rst}
4+
.. automethod:: nf_core.modules.lint.ModuleLint.module_patch
5+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# module_tests
2+
3+
```{eval-rst}
4+
.. automethod:: nf_core.modules.lint.ModuleLint.module_tests
5+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# module_version
2+
3+
```{eval-rst}
4+
.. automethod:: nf_core.modules.lint.ModuleLint.module_version
5+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# modules_structure
2+
3+
```{eval-rst}
4+
.. automethod:: nf_core.lint.PipelineLint.modules_structure
5+
```

nf_core/lint/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import datetime
99
import json
1010
import logging
11-
import re
11+
import os
1212

1313
import git
1414
import rich
@@ -172,6 +172,7 @@ class PipelineLint(nf_core.utils.Pipeline):
172172
from .files_unchanged import files_unchanged
173173
from .merge_markers import merge_markers
174174
from .modules_json import modules_json
175+
from .modules_structure import modules_structure
175176
from .multiqc_config import multiqc_config
176177
from .nextflow_config import nextflow_config
177178
from .pipeline_name_conventions import pipeline_name_conventions
@@ -227,6 +228,7 @@ def _get_all_lint_tests(release_mode):
227228
"merge_markers",
228229
"modules_json",
229230
"multiqc_config",
231+
"modules_structure",
230232
] + (["version_consistency"] if release_mode else [])
231233

232234
def _load(self):
@@ -311,7 +313,7 @@ def _lint_pipeline(self):
311313
rich.progress.BarColumn(bar_width=None),
312314
"[magenta]{task.completed} of {task.total}[reset] » [bold yellow]{task.fields[test_name]}",
313315
transient=True,
314-
disable=self.hide_progress,
316+
disable=self.hide_progress or os.environ.get("HIDE_PROGRESS", None) is not None,
315317
)
316318
with self.progress_bar:
317319
lint_progress = self.progress_bar.add_task(

nf_core/lint/modules_structure.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python
2+
3+
import logging
4+
import os
5+
from pathlib import Path
6+
7+
log = logging.getLogger(__name__)
8+
9+
10+
def modules_structure(self):
11+
"""
12+
Check that the structure of the modules directory in a pipeline is the correct one:
13+
modules/nf-core/TOOL/SUBTOOL
14+
15+
Prior to nf-core/tools release 2.6 the directory structure had an additional level of nesting:
16+
modules/nf-core/modules/TOOL/SUBTOOL
17+
"""
18+
wrong_location_modules = []
19+
for directory, _, files in os.walk(Path(self.wf_path, "modules")):
20+
if "main.nf" in files:
21+
module_path = Path(directory).relative_to(Path(self.wf_path, "modules"))
22+
parts = module_path.parts
23+
# Check that there are modules installed directly under the 'modules' directory
24+
if parts[1] == "modules":
25+
wrong_location_modules.append(module_path)
26+
# If there are modules installed in the wrong location
27+
failed = []
28+
passed = []
29+
if len(wrong_location_modules) > 0:
30+
failed = ["modules directory structure is outdated. Should be 'modules/nf-core/TOOL/SUBTOOL'"]
31+
else:
32+
passed = ["modules directory structure is correct 'modules/nf-core/TOOL/SUBTOOL'"]
33+
return {"passed": passed, "warned": [], "failed": failed, "ignored": []}

nf_core/modules/bump_versions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from __future__ import print_function
88

99
import logging
10+
import os
1011
import re
11-
from pathlib import Path
1212

1313
import questionary
1414
import rich
@@ -55,6 +55,9 @@ def bump_versions(self, module=None, all_modules=False, show_uptodate=False):
5555
self.ignored = []
5656
self.show_up_to_date = show_uptodate
5757

58+
# Check modules directory structure
59+
self.check_modules_structure()
60+
5861
# Verify that this is not a pipeline
5962
self.dir, repo_type = nf_core.modules.module_utils.get_repo_type(self.dir)
6063
if not repo_type == "modules":
@@ -101,6 +104,7 @@ def bump_versions(self, module=None, all_modules=False, show_uptodate=False):
101104
rich.progress.BarColumn(bar_width=None),
102105
"[magenta]{task.completed} of {task.total}[reset] » [bold yellow]{task.fields[test_name]}",
103106
transient=True,
107+
disable=os.environ.get("HIDE_PROGRESS", None) is not None,
104108
)
105109
with progress_bar:
106110
bump_progress = progress_bar.add_task(

nf_core/modules/create.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ def create(self):
8888
and matching Docker / Singularity images from BioContainers.
8989
"""
9090

91+
# Check modules directory structure
92+
self.check_modules_structure()
93+
9194
# Check whether the given directory is a nf-core pipeline or a clone of nf-core/modules
9295
try:
9396
self.directory, self.repo_type = nf_core.modules.module_utils.get_repo_type(self.directory, self.repo_type)

0 commit comments

Comments
 (0)