csvlint.rb icon indicating copy to clipboard operation
csvlint.rb copied to clipboard

Support CSV dialects in CLI

Open alexshpilkin opened this issue 6 years ago • 2 comments

The library supports specifying a CSV dialect (e.g. TSV), and so does the CSVW spec in more or less the same manner, but the command-line tool doesn’t pick up this info. Why not?

[Note that there are some minimal changes in the CSVW spec compared to CSVDDF—e.g. lineTerminators (may be a string or array of strings) not lineTerminator. I’d be OK even with a CSVDDF-equivalent subset.]

alexshpilkin avatar May 09 '19 07:05 alexshpilkin

The CLI actually complains about a valid CSVW metadata json descriptor containing a dialect property with

1. invalid_property. dialect: {...}

markus-oehme-pg40 avatar Oct 13 '21 08:10 markus-oehme-pg40

Ah, this seems to be a bit more nuanced: the CLI only complains if the lineTerminators attribute is a string (which is valid according to CSVW), but not if it is an array of strings (which is also valid according to CSVW). The error message however is rather unhelpful.

So this causes the error:

        "lineTerminators": "\r\n",

and this works fine:

        "lineTerminators": ["\r\n"],

markus-oehme-pg40 avatar Oct 13 '21 08:10 markus-oehme-pg40