Skip to content

Commit

Permalink
Merge pull request #2703 from mirpedrol/linting-defaults
Browse files Browse the repository at this point in the history
Linting: Handle default values of type number from nextflow schema
  • Loading branch information
mirpedrol authored Jan 30, 2024
2 parents beec488 + 57e69a5 commit ef4d323
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Linting

- Handle default values of type number from nextflow schema ([#2703](https://github.com/nf-core/tools/pull/2703))

### Modules

### Subworkflows
Expand Down
10 changes: 7 additions & 3 deletions nf_core/lint/nextflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,13 @@ def nextflow_config(self):
if str(self.nf_config[param]) == schema_default:
passed.append(f"Config default value correct: {param}")
else:
failed.append(
f"Config default value incorrect: `{param}` is set as {self._wrap_quotes(schema_default)} in `nextflow_schema.json` but is {self._wrap_quotes(self.nf_config[param])} in `nextflow.config`."
)
# Handle "number" type
if schema_default.endswith(".0") and str(self.nf_config[param]) == schema_default[:-2]:
passed.append(f"Config default value correct: {param}")
else:
failed.append(
f"Config default value incorrect: `{param}` is set as {self._wrap_quotes(schema_default)} in `nextflow_schema.json` but is {self._wrap_quotes(self.nf_config[param])} in `nextflow.config`."
)
else:
failed.append(
f"Default value from the Nextflow schema '{param} = {self._wrap_quotes(schema_default)}' not found in `nextflow.config`."
Expand Down

0 comments on commit ef4d323

Please sign in to comment.