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
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2015-12-26 11:06:15 +0300
committerXhmikosR <xhmikosr@gmail.com>2015-12-26 11:06:15 +0300
commitbe847f4eec8a9f95d4e814152e2619a5ce70ac18 (patch)
treee3a56fb24e8de63cbb5b313798ef6c4131605846
parent886077736a2ab2a37a3a7715f04ab1c11b755bd4 (diff)
parenta614a4c41c0c9e2a8bc3f7e81a6a9677ef9c5c05 (diff)
Merge pull request #62 from twbs/pluralize
Make use of `grunt.util.pluralize`.
-rw-r--r--tasks/bootlint.js18
-rw-r--r--test/bootlint_test.js10
2 files changed, 17 insertions, 11 deletions
diff --git a/tasks/bootlint.js b/tasks/bootlint.js
index 64f49ae..9208662 100644
--- a/tasks/bootlint.js
+++ b/tasks/bootlint.js
@@ -73,14 +73,20 @@ module.exports = function(grunt) {
totalFileCount++;
});
- if (totalErrCount > 0 && !options.showallerrors) {
- grunt.log.writeln().fail(totalErrCount + ' lint error(s) found across ' + totalFileCount + ' file(s).');
- grunt.log.writeln().fail('For details, look up the lint problem IDs in the Bootlint wiki: https://github.com/twbs/bootlint/wiki');
- } else if (totalErrCount > 0 && options.showallerrors) {
- grunt.fail.warn(totalErrCount + ' lint error(s) found across ' + totalFileCount + ' file(s).');
+ var errorStr = grunt.util.pluralize(totalErrCount, 'error/errors');
+ var fileStr = grunt.util.pluralize(totalFileCount, 'file/files');
+
+ if (totalErrCount > 0) {
+ if (options.showallerrors) {
+ grunt.fail.warn(totalErrCount + ' lint ' + errorStr + ' found across ' + totalFileCount + ' ' + fileStr + '.');
+ } else {
+ grunt.log.writeln().fail(totalErrCount + ' lint ' + errorStr + ' found across ' + totalFileCount + ' ' + fileStr + '.');
+ grunt.log.writeln().fail('For details, look up the lint problem IDs in the Bootlint wiki: https://github.com/twbs/bootlint/wiki');
+ }
} else {
- grunt.log.ok(totalFileCount + ' file(s) lint free.');
+ grunt.log.ok(totalFileCount + ' ' + fileStr + ' lint free.');
}
+
});
function getDisabledIdsForFilepath(filepath) {
diff --git a/test/bootlint_test.js b/test/bootlint_test.js
index c5667f3..dfc3cb2 100644
--- a/test/bootlint_test.js
+++ b/test/bootlint_test.js
@@ -33,7 +33,7 @@ exports.bootlint = {
'Should print file path');
test.ok(result.stdout.indexOf('Document is missing a DOCTYPE declaration') >= 0,
'Should warn about missing a DOCTYPE');
- test.ok(result.stdout.indexOf('9 lint error(s) found across 5 file(s)') >= 0,
+ test.ok(result.stdout.indexOf('9 lint errors found across 5 files') >= 0,
'Should print number of lint errors and files');
test.done();
});
@@ -50,7 +50,7 @@ exports.bootlint = {
'Should warn about missing charset');
test.ok(result.stdout.indexOf('W005') === -1,
'Should not warn about missing jQuery');
- test.ok(result.stdout.indexOf('1 lint error(s) found across 3 file(s)') >= 0,
+ test.ok(result.stdout.indexOf('1 lint error found across 3 files') >= 0,
'Should print correct number of lint errors and files');
test.done();
});
@@ -100,7 +100,7 @@ exports.bootlint = {
grunt: true,
args: ['bootlint:showallerrors', '--no-color']
}, function(err, result) {
- test.ok(result.stdout.indexOf('8 lint error(s) found across 3 file(s). Use --force to continue.') >= 0,
+ test.ok(result.stdout.indexOf('8 lint errors found across 3 files. Use --force to continue.') >= 0,
'Should show all errors before hard fail.');
test.done();
});
@@ -111,7 +111,7 @@ exports.bootlint = {
grunt: true,
args: ['bootlint:showallerrorswithstop', '--no-color']
}, function(err, result) {
- test.ok(result.stdout.indexOf('8 lint error(s) found across 3 file(s). Use --force to continue.') >= 0,
+ test.ok(result.stdout.indexOf('8 lint errors found across 3 files. Use --force to continue.') >= 0,
'Should show all errors before hard fail even if stopon* is set.');
test.done();
});
@@ -122,7 +122,7 @@ exports.bootlint = {
grunt: true,
args: ['bootlint:pass', '--no-color']
}, function(err, result) {
- test.ok(result.stdout.indexOf('1 file(s) lint free.') >= 0,
+ test.ok(result.stdout.indexOf('1 file lint free.') >= 0,
'Should print correct number of lint free files');
test.done();
});