Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

CSVReporter generates invalid CSV #298

Open
babymastodon opened this issue Jul 7, 2014 · 4 comments · Fixed by coffeelint/coffeelint#14 · May be fixed by #514
Open

CSVReporter generates invalid CSV #298

babymastodon opened this issue Jul 7, 2014 · 4 comments · Fixed by coffeelint/coffeelint#14 · May be fixed by #514
Labels

Comments

@babymastodon
Copy link

The filename and message columns are not escaped. Unescaped commas and newlines break the resulting CSV file. Here's an example output:

path,lineNumber,lineNumberEnd,level,message
myfile.coffee,587,,error,Empty parameter list is forbidden
myfile.coffee,593,,error,Empty parameter list is forbidden
myfile.coffee,597,,error,Empty parameter list is forbidden
myfile.coffee,788,,error,Empty parameter list is forbidden
myfile.coffee,1167,,warn,Colon assignment without proper spacing Incorrect spacing around column 31.
Expected left: 0, right: 1.
Got left: 0, right: 0..
myfile.coffee,2070,,error,Duplicate key defined in object or class
@AsaAyers AsaAyers added the bug label Aug 20, 2014
swang added a commit to swang/coffeelint that referenced this issue Oct 7, 2015
Follows this http://tools.ietf.org/html/rfc4180 in regards to using
double quotes around fields that can have commas or spaces, as well as
using two quotes ("") to escape inside a field's value

Closes clutchski#298
@swang swang linked a pull request Oct 7, 2015 that will close this issue
@swang
Copy link
Collaborator

swang commented Oct 7, 2015

Hi, sorry this ticket has been up a while, but never saw this.

Even though CSVs don't have a proper standard. I decided to go by this RFC: http://tools.ietf.org/html/rfc4180

The general gist of it is, double quotes escape spaces/commas in fields, but uses two double quotes to escape a double quote in the field value. Also CRLF are not escaped in field values.

@babymastodon
Copy link
Author

Thanks for looking into this. I guess it's reasonable to delete the
existing double quotes from the message.

On Wed, Oct 7, 2015 at 11:07 AM, Shuan Wang [email protected]
wrote:

Hi, sorry this ticket has been up a while, but never saw this.

Even though CSVs don't have a proper standard. I decided to go by this
RFC: http://tools.ietf.org/html/rfc4180

The general gist of it is, double quotes escape spaces/commas in fields,
but uses two double quotes to escape a double quote in the field value.
Also CRLF are not escaped in field values.


Reply to this email directly or view it on GitHub
#298 (comment)
.

@sils
Copy link

sils commented Dec 22, 2015

Note that some messages even seem contain escape characters which don't obey the --color=never setting and mess up the CSV even further

@UziTech
Copy link

UziTech commented Feb 5, 2020

coffeelint/coffeelint#14 fixes double quotes, commas, and new lines in v3.0

@sils if --color=never is still an issue please open a new issue on the new repo https://github.com/coffeelint/coffeelint

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants