Skip to content
Snippets Groups Projects
Commit 712be7d4 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Better log when running jshint

parent de692d1b
No related branches found
No related tags found
No related merge requests found
...@@ -54,22 +54,22 @@ function processFiles(dir, callback) { ...@@ -54,22 +54,22 @@ function processFiles(dir, callback) {
} }
function lintFile(file, callback) { function lintFile(file, callback) {
console.log("Linting " + file); console.log("Linting '" + file + "'");
fs.readFile(file, function(err, data) { fs.readFile(file, function(err, data) {
if(err) { if(err) {
console.log('Error: ' + err); console.error('Error: ' + err);
return; return;
} }
if(jshint(data.toString())) { if(jshint(data.toString())) {
console.log('File ' + file + ' has no errors.'); //console.log('File ' + file + ' has no errors.');
console.log('-----------------------------------------'); //console.log('-----------------------------------------');
callback(false); callback(false);
} else { } else {
console.log('Errors in file ' + file); console.error("Errors in file '" + file + "':");
var out = jshint.data(), var out = jshint.data(),
errors = out.errors; errors = out.errors;
for(var j = 0; j < errors.length; j++) { for(var j = 0; j < errors.length; j++) {
console.log(errors[j].line + ':' + errors[j].character + ' -> ' + errors[j].reason + ' -> ' + console.error( " Line " + errors[j].line + ':' + errors[j].character + ' -> ' + errors[j].reason + ' -> ' +
errors[j].evidence); errors[j].evidence);
} }
console.log('-----------------------------------------'); console.log('-----------------------------------------');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment