Bug: `nf-core pipelines lint` mishandles defaults for nullable numeric parameters
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Start at PipelineSchema.sanitise_param_default(), where the code compares param["type"] == "number" and otherwise coerces the default to str; a list type such as ["number", "null"] falls into the string branch. Rework the check so any type list containing number keeps a numeric default while null remains valid, then rerun nf-core pipelines lint --key schema_lint plus the pipeline schema unit tests. Done means the 400 default is reported as valid and non-numeric defaults still fail as before.
Written by the indexing model from the issue text.
Description
Description of the bug
Given this schema parameter:
{
"type": ["number", "null"],
"default": 400
}
Running:
nf-core pipelines lint --key schema_lint
fails with:
Default parameters are invalid: '400' is not of type 'number', 'null'
The issue appears to be in PipelineSchema.sanitise_param_default():
if param["type"] == "number":
param["default"] = float(param["default"])
return param
param["default"] = str(param["default"])
For ["number", "null"], the type comparison fails and the numeric default is converted to the string "400". This then fails JSON Schema validation.
Expected behavior: nullable numeric types should retain numeric defaults, e.g. 400, while still accepting null.
Command used and terminal output
System information
nf-core/tools version: 4.2.2
- Dominant language
- Python
- Stars
- 333
- Forks
- 273
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 51
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nf-core/tools
-
modules lint: a meta.yml lock_file path that does not exist should fail, not warnPossibly taken @pinin4fjords claimed this 12 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
GitHub handle should allow underscoresPossibly taken @PrakarshSrivastav claimed this 20 days ago. Openbug good-first-issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nf-core/tools#4581 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
`modules containers create`: Wave ignores `basePackages`, because the request puts it at the top levelMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nf-core/tools#4542 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Incorrect if-statement logic in nf-core modules test outputPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nf-core/tools#4327 · 4 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
UKGovernmentBEIS/inspect_ai#6733 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ProyectoRespira/respira-webapp#334 ·
Maintainers usually reply within 1 day
-
bug security-alert
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
spectrayan/carefold#391 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Jakeschincariol/instagram-agent-skill#83 ·
Maintainers usually reply within 10 days
-
Difficulty 1/5 Under an hour Newbie friendliness 64/100