Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly parse the names form manifest.contributors #3364

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

- 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))
- Properly parse the names form `manifest.contributors` ([#3364](https://github.com/nf-core/tools/pull/3364))

### Version updates

Expand Down
14 changes: 5 additions & 9 deletions nf_core/pipelines/rocrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,20 +270,16 @@ def add_main_authors(self, wf_file: rocrate.model.entity.Entity) -> None:
authors = []
if "manifest.author" in self.pipeline_obj.nf_config:
authors.extend([a.strip() for a in self.pipeline_obj.nf_config["manifest.author"].split(",")])
if "manifest.contributor" in self.pipeline_obj.nf_config:
authors.extend(
[
c.get("name", "").strip()
for c in self.pipeline_obj.nf_config["manifest.contributor"]
if "name" in c
]
)
if "manifest.contributors" in self.pipeline_obj.nf_config:
contributors = self.pipeline_obj.nf_config["manifest.contributors"]
names = re.findall(r"name:'([^']+)'", contributors)
authors.extend(names)
if not authors:
raise KeyError("No authors found")
# add manifest authors as maintainer to crate

except KeyError:
log.error("No author or contributor fields found in manifest of nextflow.config")
log.error("No author or contributors fields found in manifest of nextflow.config")
return
# remove duplicates
authors = list(set(authors))
Expand Down
Loading