Skip to content

Fix orcid regex for dockstore_init #1348

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

Merged
merged 3 commits into from
Jan 26, 2023
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
6 changes: 4 additions & 2 deletions planemo/workflow_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ def generate_dockstore_yaml(directory: str, publish: bool = True) -> str:
continue
if field == "identifier":
# Check if it is an orcid:
orcid = re.findall(r"(?:\d{4}-){3}\d{3}", value)
orcid = re.findall(r"(?:\d{4}-){3}\d{4}", value)
if len(orcid) > 0:
# Check the orcid is valid
if (
requests.get(
f"https://orcid.org/{orcid[0]}", headers={"Accept": "application/xml"}
f"https://orcid.org/{orcid[0]}",
headers={"Accept": "application/xml"},
allow_redirects=False,
).status_code
== 200
):
Expand Down
1 change: 1 addition & 0 deletions tests/test_cmd_dockstore_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ def run_dockstore_init_with_creator(self):
assert "workflows" in dockstore_config
assert len(dockstore_config["workflows"]) == 1
assert "authors" in dockstore_config["workflows"]
assert dockstore_config["workflows"]["authors"]["orcid"] == "0000-0002-1964-4960"
workflow_lint_cmd = ["workflow_lint", "--skip", "tool_ids", "--fail_level", "error", f]
self._check_exit_code(workflow_lint_cmd)