forked from clutchski/coffeelint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSVReporter: Properly double quote field
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
- Loading branch information
Showing
3 changed files
with
61 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
module.exports = class CSVReporter | ||
|
||
constructor : (@errorReport, options = {}) -> | ||
constructor: (@errorReport, options = {}) -> | ||
|
||
print : (message) -> | ||
print: (message) -> | ||
# coffeelint: disable=no_debugger | ||
console.log message | ||
# coffeelint: enable=no_debugger | ||
|
||
publish : () -> | ||
header = ["path","lineNumber", "lineNumberEnd", "level", "message"] | ||
publish: () -> | ||
header = ["path", "lineNumber", "lineNumberEnd", "level", "message"] | ||
@print header.join(",") | ||
for path, errors of @errorReport.paths | ||
for e in errors | ||
# Having the context is useful for the cyclomatic_complexity | ||
# rule and critical for the undefined_variables rule. | ||
e.message += " #{e.context}." if e.context | ||
e.message += " #{e.context}" if e.context | ||
f = [ | ||
path | ||
e.lineNumber | ||
e.lineNumberEnd ? e.lineNumberEnd | ||
e.level | ||
e.message | ||
'"' + e.message.replace(/\"/g, "") + '"' | ||
] | ||
@print f.join(",") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
module.exports = class RawReporter | ||
|
||
constructor : (@errorReport, options = {}) -> | ||
constructor: (@errorReport, options = {}) -> | ||
|
||
print : (message) -> | ||
print: (message) -> | ||
# coffeelint: disable=no_debugger | ||
console.log message | ||
# coffeelint: enable=no_debugger | ||
|
||
publish : () -> | ||
publish: () -> | ||
@print JSON.stringify(@errorReport.paths, undefined, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters