Skip to content

feat: multi params-file support#34

Open
mageshwaran-lifebit wants to merge 1 commit into25.10.4from
multi-params-file-support
Open

feat: multi params-file support#34
mageshwaran-lifebit wants to merge 1 commit into25.10.4from
multi-params-file-support

Conversation

@mageshwaran-lifebit
Copy link
Copy Markdown

This pull request updates the handling of multiple parameter files in the CmdRun command. Now, users can specify a comma-separated list of parameter files, and each will be processed in sequence.

Parameter file handling improvements:

  • Updated the logic in CmdRun so that if the --params-file option contains multiple files separated by commas, each file is validated and loaded individually, supporting both JSON and YAML formats.

readJsonFile(path, configVars, result)
else if( type == 'yml' || type == 'yaml' )
readYamlFile(path, configVars, result)
for( String paramFile: file.split(',') ) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The comma-separated string for --params-file is split using split(',') without trimming whitespace or filtering empty strings, causing errors for common inputs like "file1.json, file2.yaml".
Severity: MEDIUM

Suggested Fix

Modify the string parsing to handle whitespace and empty strings gracefully. Instead of file.split(','), use a more robust method like file.tokenize(',').collect { it.trim() }.findAll { it }. This will split the string, trim whitespace from each resulting path, and remove any empty entries before processing, aligning with existing patterns in the codebase for handling comma-separated values.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy#L690

Potential issue: The code at line 690 splits the `--params-file` string by commas using
`file.split(',')`. This method does not trim whitespace from the resulting file paths.
If a user provides a list with spaces after commas (e.g., `"file1.json, file2.yaml"`),
the subsequent call to `FileHelper.asPath()` will receive a path with a leading space
(e.g., `" file2.yaml"`) and throw an `IllegalArgumentException`. Similarly, trailing or
consecutive commas will produce empty strings, also causing an exception. This deviates
from the established pattern in the codebase for parsing comma-separated lists, which
typically involves trimming and filtering empty entries.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant