Skip to content

Fix bug in unexpected param log with false values.#871

Merged
ewels merged 1 commit intonf-core:devfrom
ewels:lib-functions-bugfix
Mar 12, 2021
Merged

Fix bug in unexpected param log with false values.#871
ewels merged 1 commit intonf-core:devfrom
ewels:lib-functions-bugfix

Conversation

@ewels
Copy link
Copy Markdown
Member

@ewels ewels commented Mar 11, 2021

Follow-on to #857

Tried to add params.input_paths = null to nextflow.config to avoid the warning that Nextflow threw about undefined params and hit a bug in the new unexpected params code:

JSONObject["input_paths"] not found.
 -- Check script 'nf-core-test/main.nf' at line: 28 or see '.nextflow.log' file for more details

After a bit of digging I figured out that it was because this code was removing anything evaluating to false from the parameters map:

// remove anything evaluating to false
if (!p['value']) {
new_params.remove(p.key)
}

So just switching to use params instead of cleanedParams when printing the value of the unexpected parameter solved the issue.

Also included a couple of other minor tweaks, notably just repeating the validation at the end of the pipeline. This is so that we don't have to repeat the code that prints the warnings so a bit less code maintenance in the main pipeline.

* Refine the log messages a bit and tweak one or two extras.
* Define params.input_paths in nextflow.config to avoid core Nextflow warning
* Add params.input_paths to params.schema_ignore_params
@ewels ewels added the template nf-core pipeline/component template label Mar 11, 2021
@ewels ewels requested a review from KevinMenden March 11, 2021 18:58
@KevinMenden
Copy link
Copy Markdown
Contributor

Nice fix, thanks! :)

Was thinking if it makes sense to force the second call to validateParams to print unexpected params? But then a user can't really switch it off so maybe best to leave it like this 👍

@ewels ewels merged commit 810b4b8 into nf-core:dev Mar 12, 2021
@ewels ewels deleted the lib-functions-bugfix branch March 12, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

template nf-core pipeline/component template

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants