clutchski / coffeelint

Lint your CoffeeScript.
http://www.coffeelint.org
Other
1.18k stars 171 forks source link

CSVReporter generates invalid CSV #298

Open babymastodon opened 10 years ago

babymastodon commented 10 years ago

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
swang commented 9 years ago

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 commented 9 years ago

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 notifications@github.com 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 https://github.com/clutchski/coffeelint/issues/298#issuecomment-146280659 .

sils commented 8 years ago

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 commented 4 years ago

https://github.com/coffeelint/coffeelint/pull/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