Data-Liberation-Front / csvlint.rb

The gem behind http://csvlint.io
MIT License
283 stars 86 forks source link

Support CSV dialects in CLI #225

Open alexshpilkin opened 5 years ago

alexshpilkin commented 5 years ago

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.]

markus-oehme-pg40 commented 2 years ago

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

1. invalid_property. dialect: {...}
markus-oehme-pg40 commented 2 years ago

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"],