Skip to content

Quote CSV values only when required - #7377

Open
xHaMMaDy wants to merge 1 commit into
nextflow-io:masterfrom
xHaMMaDy:fix/csv-writer-minimal-quoting
Open

Quote CSV values only when required#7377
xHaMMaDy wants to merge 1 commit into
nextflow-io:masterfrom
xHaMMaDy:fix/csv-writer-minimal-quoting

Conversation

@xHaMMaDy

Copy link
Copy Markdown

Summary

  • quote CSV headers and record values only when required for valid CSV
  • escape embedded double quotes using the standard doubled-quote representation
  • cover plain values, separators, quotes, CR/LF, empty and null values, and custom separators

Tests

  • ./gradlew :nextflow:test --tests nextflow.util.CsvWriterTest

Closes #5546

Assisted-by: OpenAI Codex
Signed-off-by: xHaMMaDy <ibrahimhammad364@gmail.com>
Copilot AI review requested due to automatic review settings July 22, 2026 18:54
@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for nextflow-docs canceled.

Name Link
🔨 Latest commit 8444079
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs/deploys/6a6111f861c9130008c61694

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Nextflow’s CsvWriter so it only quotes CSV headers and field values when necessary to produce valid CSV (e.g., values containing separators, quotes, or CR/LF), addressing readability and downstream parsing issues (e.g., index files used with .splitCsv).

Changes:

  • Emit unquoted fields by default; quote only when required and escape embedded double quotes using the doubled-quote CSV convention.
  • Apply the same conditional-quoting logic to headers.
  • Expand unit tests to cover separators, quotes, CR/LF, empty/null values, and custom separators.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
modules/nextflow/src/main/groovy/nextflow/util/CsvWriter.groovy Introduces conditional quoting/escaping via formatCsvValue and applies it to headers and row values.
modules/nextflow/src/test/groovy/nextflow/util/CsvWriterTest.groovy Updates existing expectations and adds coverage for quoting/escaping behavior and custom separators.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A flag to remove quotation marks from index file

3 participants