Skip to content

Commit 4164503

Browse files
authored
Merge pull request #3767 from rrahn/feature/dynamic-org-for-linting
Use the org from the .nf-core.yml when linting manifest name and homePage.
2 parents f58c564 + 369d2f1 commit 4164503

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- ignore files in gitignore also for pipeline_if_empty_null lint test ([#3722](https://github.com/nf-core/tools/pull/3722))
1616
- do not check pytest_modules.yml file, deprecating ([#3748](https://github.com/nf-core/tools/pull/3748))
17+
- Use the org from the .nf-core.yml when linting manifest name and homePage. ([#3767](https://github.com/nf-core/tools/pull/3767))
1718

1819
### Modules
1920

nf_core/pipelines/lint/nextflow_config.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Optional, Union
66

77
from nf_core.pipelines.schema import PipelineSchema
8+
from nf_core.utils import load_tools_config
89

910
log = logging.getLogger(__name__)
1011

@@ -255,30 +256,35 @@ def nextflow_config(self) -> dict[str, list[str]]:
255256
else:
256257
failed.append(f"Config ``{k}`` did not have correct value: ``{self.nf_config.get(k)}``")
257258

259+
_, nf_core_yaml_config = load_tools_config(self.wf_path)
260+
org_name = "nf-core"
261+
if nf_core_yaml_config and getattr(nf_core_yaml_config, "template", None):
262+
org_name = getattr(nf_core_yaml_config.template, "org", org_name) or org_name
263+
258264
if "manifest.name" not in ignore_configs:
259265
# Check that the pipeline name starts with nf-core
260266
try:
261267
manifest_name = self.nf_config.get("manifest.name", "").strip("'\"")
262-
if not manifest_name.startswith("nf-core/"):
268+
if not manifest_name.startswith(f"{org_name}/"):
263269
raise AssertionError()
264270
except (AssertionError, IndexError):
265-
failed.append(f"Config ``manifest.name`` did not begin with ``nf-core/``:\n {manifest_name}")
271+
failed.append(f"Config ``manifest.name`` did not begin with ``{org_name}/``:\n {manifest_name}")
266272
else:
267-
passed.append("Config ``manifest.name`` began with ``nf-core/``")
273+
passed.append(f"Config ``manifest.name`` began with ``{org_name}/``")
268274

269275
if "manifest.homePage" not in ignore_configs:
270276
# Check that the homePage is set to the GitHub URL
271277
try:
272278
manifest_homepage = self.nf_config.get("manifest.homePage", "").strip("'\"")
273-
if not manifest_homepage.startswith("https://github.com/nf-core/"):
279+
if not manifest_homepage.startswith(f"https://github.com/{org_name}/"):
274280
raise AssertionError()
275281
except (AssertionError, IndexError):
276282
failed.append(
277-
f"Config variable ``manifest.homePage`` did not begin with https://github.com/nf-core/:\n {manifest_homepage}"
283+
f"Config variable ``manifest.homePage`` did not begin with https://github.com/{org_name}/:\n {manifest_homepage}"
278284
)
279285

280286
else:
281-
passed.append("Config variable ``manifest.homePage`` began with https://github.com/nf-core/")
287+
passed.append(f"Config variable ``manifest.homePage`` began with https://github.com/{org_name}/")
282288

283289
# Check that the DAG filename ends in ``.svg``
284290
if "dag.file" in self.nf_config:

0 commit comments

Comments
 (0)