Skip to content

Commit 0450503

Browse files
authored
Merge pull request #3317 from lmReef/fix-linting-error
Fix meta_yml linting error
2 parents b2132cf + cc38f8d commit 0450503

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
### Linting
2626

2727
- allow mixed `str` and `dict` entries in lint config ([#3228](https://github.com/nf-core/tools/pull/3228))
28+
- fix meta_yml linting test failing due to module.process_name always being "" ([#3317](https://github.com/nf-core/tools/pull/3317))
2829
- fix module section regex matching wrong things ([#3321](https://github.com/nf-core/tools/pull/3321))
2930

3031
### Modules

nf_core/components/nfcore_component.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def __init__(
6262
# Initialize the important files
6363
self.main_nf: Path = Path(self.component_dir, "main.nf")
6464
self.meta_yml: Optional[Path] = Path(self.component_dir, "meta.yml")
65-
self.process_name = ""
6665
self.environment_yml: Optional[Path] = Path(self.component_dir, "environment.yml")
6766

6867
component_list = self.component_name.split("/")
@@ -96,6 +95,8 @@ def __init__(
9695
self.test_yml = None
9796
self.test_main_nf = None
9897

98+
self.process_name: str = self._get_process_name()
99+
99100
def __repr__(self) -> str:
100101
return f"<NFCoreComponent {self.component_name} {self.component_dir} {self.repo_url}>"
101102

@@ -169,6 +170,13 @@ def _get_included_components_in_chained_tests(self, main_nf_test: Union[Path, st
169170
included_components.append(component)
170171
return included_components
171172

173+
def _get_process_name(self):
174+
with open(self.main_nf) as fh:
175+
for line in fh:
176+
if re.search(r"^\s*process\s*\w*\s*{", line):
177+
return re.search(r"^\s*process\s*(\w*)\s*{.*", line).group(1) or ""
178+
return ""
179+
172180
def get_inputs_from_main_nf(self) -> None:
173181
"""Collect all inputs from the main.nf file."""
174182
inputs: Any = [] # Can be 'list[list[dict[str, dict[str, str]]]]' or 'list[str]'

nf_core/modules/lint/main_nf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ def check_process_section(self, lines, registry, fix_version, progress_bar):
256256
bioconda_packages = []
257257

258258
# Process name should be all capital letters
259-
self.process_name = lines[0].split()[1]
260259
if all(x.upper() for x in self.process_name):
261260
self.passed.append(("process_capitals", "Process name is in capital letters", self.main_nf))
262261
else:

0 commit comments

Comments
 (0)