Skip to content

Commit

Permalink
Add coffeelint-stylish reporter.
Browse files Browse the repository at this point in the history
  • Loading branch information
janraasch committed Dec 23, 2013
1 parent efc2eca commit e507ec9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"grunt": "~0.4"
},
"dependencies": {
"coffeelint": "~1.0"
"coffeelint": "~1.0",
"coffeelint-stylish": "~0.0.1"
},
"devDependencies": {
"grunt": "~0.4",
Expand Down
6 changes: 3 additions & 3 deletions tasks/coffeelint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = function(grunt) {
var coffeelint = require('coffeelint');
var reporter = require('coffeelint-stylish').reporter;

grunt.registerMultiTask('coffeelint', 'Validate files with CoffeeLint', function() {

Expand Down Expand Up @@ -27,23 +28,22 @@ module.exports = function(grunt) {
return grunt.verbose.ok();
}

reporter(file, errors);

errors.forEach(function(error) {
var status, message;

if (error.level === 'error') {
errorCount += 1;
status = "[error]".red;
} else if (error.level === 'warn') {
warnCount += 1;
status = "[warn]".yellow;
} else {
return;
}

message = file + ':' + error.lineNumber + ' ' + error.message +
' (' + error.rule + ')';

grunt.log.writeln(status + ' ' + message);
grunt.event.emit('coffeelint:' + error.level, error.level, message);
grunt.event.emit('coffeelint:any', error.level, message);
});
Expand Down

0 comments on commit e507ec9

Please sign in to comment.