Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/grunt-bootlint.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tasks
diff options
context:
space:
mode:
authorZac Echola <zac.echola@so.mnscu.edu>2014-08-19 23:02:14 +0400
committerZac Echola <zac.echola@so.mnscu.edu>2014-08-19 23:02:14 +0400
commita4320a1c559b1720dfcae46703f260780cc9a237 (patch)
tree9c5738124e24cd74c5996eb7ac0eae8134aa056c /tasks
parentae31bb28f74b306437ca6cb34662935c3910434e (diff)
Adding error relaxation.
Closes #4
Diffstat (limited to 'tasks')
-rw-r--r--tasks/bootlint.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/tasks/bootlint.js b/tasks/bootlint.js
index aa10abb..653f507 100644
--- a/tasks/bootlint.js
+++ b/tasks/bootlint.js
@@ -25,8 +25,6 @@ module.exports = function(grunt) {
done: 'All Done!'.bold.ok
};
-
-
grunt.registerMultiTask('bootlint', 'An HTML linter for Bootstrap projects', function() {
var options = this.options({
stoponerror: false,
@@ -48,21 +46,32 @@ module.exports = function(grunt) {
})
.forEach(function(filepath) {
var src = grunt.file.read(filepath);
-
var errs = bootlint.lintHtml(src);
- totalErrCount += errs.length;
- errs.forEach(function (msg) {
+ grunt.log.writeln(msg.start + filepath.ok);
+
+ // Remove relaxed errors
+ if (options.relaxerror.length) {
+ errs = errs.filter(function(elem) {
+ return options.relaxerror.indexOf(elem) < 0;
+ });
+ }
+
+ errs.forEach(function (err) {
+ totalErrCount += errs.length;
if (options.stoponerror) {
- grunt.fail.warn(filepath + ':' + msg.error);
+ grunt.fail.warn(filepath + ':' + err.error);
} else {
- grunt.log.warn(filepath + ':', msg.error);
+ grunt.log.warn(filepath + ':', err.error);
}
});
+
+ if (!errs.length) { grunt.log.writeln(filepath.ok + ' is OK!'.ok); }
+
});
if (totalErrCount > 0) {
- grunt.log.warn(totalErrCount + ' lint errors found.');
+ grunt.log.writeln(totalErrCount + ' lint errors found.');
} else {
grunt.log.writeln(msg.done);
}