Skip to content

Commit

Permalink
Merge pull request #2328 from mirpedrol/lint-schema-null-values
Browse files Browse the repository at this point in the history
lint for default values null, empty strings or none
  • Loading branch information
mirpedrol authored Jun 20, 2023
2 parents 37c3d06 + c10c891 commit cf15617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- Warn if container access is denied ([#2270](https://github.com/nf-core/tools/pull/2270))
- Error if module container specification has quay.io as prefix when it shouldn't have ([#2278])(https://github.com/nf-core/tools/pull/2278/files)
- Detect if container is 'simple name' and try to contact quay.io server by default ([#2281](https://github.com/nf-core/tools/pull/2281))
- Warn about null/None/empty default values in `nextflow_schema.json` ([#3328](https://github.com/nf-core/tools/pull/2328))

### Modules

Expand Down
5 changes: 5 additions & 0 deletions nf_core/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ def validate_default_params(self):
jsonschema.validate(self.schema_defaults, schema_no_required)
except jsonschema.exceptions.ValidationError as e:
raise AssertionError(f"Default parameters are invalid: {e.message}")
for param, default in self.schema_defaults.items():
if default in ("null", "", None, "None"):
log.warning(
f"[yellow][!] Default parameter '{param}' is empty or null. It is advisable to remove the default from the schema"
)
log.info("[green][✓] Default parameters match schema validation")

# Make sure every default parameter exists in the nextflow.config and is of correct type
Expand Down

0 comments on commit cf15617

Please sign in to comment.