diff --git a/src/formatters/compact.js b/src/formatters/compact.js index 9703abad..bc4ac23b 100644 --- a/src/formatters/compact.js +++ b/src/formatters/compact.js @@ -50,10 +50,10 @@ CSSLint.addFormatter({ output += filename + ": " + capitalize(message.type) + " - " + message.message + "\n"; } else { output += filename + ": " + "line " + message.line + - ", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + "\n"; + ", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + " (" + message.rule.id + ")\n"; } }); return output; } -}); \ No newline at end of file +}); diff --git a/tests/formatters/compact.js b/tests/formatters/compact.js index 64786c14..b6915a0d 100644 --- a/tests/formatters/compact.js +++ b/tests/formatters/compact.js @@ -20,11 +20,11 @@ "File with problems should list them": function() { var result = { messages: [ - { type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: [] }, - { type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: [] } + { type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } }, + { type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } } ], stats: [] }, - err = "path/to/FILE: line 2, col 1, Error - BOGUS ERROR\n", - warning = "path/to/FILE: line 1, col 1, Warning - BOGUS WARNING\n", + err = "path/to/FILE: line 2, col 1, Error - BOGUS ERROR (BOGUS_RULE_ID)\n", + warning = "path/to/FILE: line 1, col 1, Warning - BOGUS WARNING (BOGUS_RULE_ID)\n", expected = err + warning, actual = CSSLint.getFormatter("compact").formatResults(result, "path/to/FILE", {fullPath: "/absolute/path/to/FILE"}); Assert.areEqual(expected, actual); @@ -32,11 +32,11 @@ "Should output relative file paths": function() { var result = { messages: [ - { type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: [] }, - { type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: [] } + { type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } }, + { type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } } ], stats: [] }, - err = "path/to/FILE: line 2, col 1, Error - BOGUS ERROR\n", - warning = "path/to/FILE: line 1, col 1, Warning - BOGUS WARNING\n", + err = "path/to/FILE: line 2, col 1, Error - BOGUS ERROR (BOGUS_RULE_ID)\n", + warning = "path/to/FILE: line 1, col 1, Warning - BOGUS WARNING (BOGUS_RULE_ID)\n", expected = err + warning, actual = CSSLint.getFormatter("compact").formatResults(result, "path/to/FILE", {fullPath: "/absolute/path/to/FILE"}); Assert.areEqual(expected, actual);