Skip to content

Commit

Permalink
Merge pull request #3362 from mirpedrol/fix-3359-lint-repo
Browse files Browse the repository at this point in the history
Use `manifest.contributors` names if available, otherwise default to `manifest.author`
  • Loading branch information
mirpedrol authored Dec 17, 2024
2 parents 769f8dd + ac7fd48 commit 728a91c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
### General

- Add missing p ([#3357](https://github.com/nf-core/tools/pull/3357))
- Use `manifest.contributors` names if available, otherwise default to `manifest.author` ([#3362](https://github.com/nf-core/tools/pull/3362))

### Version updates

Expand Down
11 changes: 9 additions & 2 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,13 +1327,20 @@ def load_tools_config(directory: Union[str, Path] = ".") -> Tuple[Optional[Path]
# Retrieve information if template from config file is empty
template = tools_config.get("template")
config_template_keys = template.keys() if template is not None else []
# Get author names from contributors first, then fallback to author
if "manifest.contributors" in wf_config:
contributors = wf_config["manifest.contributors"]
names = re.findall(r"name:'([^']+)'", contributors)
author_names = ", ".join(names)
else:
author_names = wf_config["manifest.author"].strip("'\"")
if nf_core_yaml_config.template is None:
# The .nf-core.yml file did not contain template information
nf_core_yaml_config.template = NFCoreTemplateConfig(
org="nf-core",
name=wf_config["manifest.name"].strip("'\"").split("/")[-1],
description=wf_config["manifest.description"].strip("'\""),
author=wf_config["manifest.author"].strip("'\""),
author=author_names,
version=wf_config["manifest.version"].strip("'\""),
outdir=str(directory),
is_nfcore=True,
Expand All @@ -1344,7 +1351,7 @@ def load_tools_config(directory: Union[str, Path] = ".") -> Tuple[Optional[Path]
org=tools_config["template"].get("prefix", tools_config["template"].get("org", "nf-core")),
name=tools_config["template"].get("name", wf_config["manifest.name"].strip("'\"").split("/")[-1]),
description=tools_config["template"].get("description", wf_config["manifest.description"].strip("'\"")),
author=tools_config["template"].get("author", wf_config["manifest.author"].strip("'\"")),
author=tools_config["template"].get("author", author_names),
version=tools_config["template"].get("version", wf_config["manifest.version"].strip("'\"")),
outdir=tools_config["template"].get("outdir", str(directory)),
skip_features=tools_config["template"].get("skip", tools_config["template"].get("skip_features")),
Expand Down

0 comments on commit 728a91c

Please sign in to comment.