8000 #4174: Allow to activate trailing delimiter for CSV parser by stefan-korn · Pull Request #4175 · GetDKAN/dkan · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@stefan-korn
Copy link
Contributor

fixes #4174

  • Test coverage exists
  • Documentation exists

QA Steps

  • use a csv file with a trailing delimiter and note that the import will fail
  • change the trailing_delimiter setting via EventSubscriber to true and note that the import (drush dkan:datastore:reimport) will now work

Copy link
Member
@dafeder dafeder left a comment

Choose a reason for hiding this comment

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

This makes a lot of sense to implement. You probably know what I'm going to say next - are you able to provide test coverage for it?

8000
$parserConfiguration = $this->dispatchEvent(self::EVENT_CONFIGURE_PARSER, $parserConfiguration);

$parser = Csv::getParser($parserConfiguration['delimiter'], $parserConfiguration['quote'], $parserConfiguration['escape'], $parserConfiguration['record_end']);
if (!empty($parserConfiguration['trailing_delimiter'])) {
Copy link
Member

Choose a reason for hiding this comment

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

Might it not be a little cleaner to expect this to be a bool and therefore have a tighter conditional for it?

Suggested change
if (!empty($parserConfiguration['trailing_delimiter'])) {
if ($parserConfiguration['trailing_delimiter'] === TRUE) {

@dafeder dafeder self-assigned this Jul 3, 2024
@dafeder dafeder marked this pull request as draft August 27, 2025 17:12
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.

Allow to activate trailing delimiter for CSV parser

3 participants

0