gulp-rb-validate-css
Advanced tools
Comparing version 0.0.5 to 0.0.6
54
index.js
@@ -22,4 +22,4 @@ /*jslint node: true*/ | ||
if (mistake.length > 80) { | ||
mistake = mistake.substr(0, 80) + "..."; | ||
if (mistake.length > 60) { | ||
mistake = mistake.substr(0, 60) + "..."; | ||
} else if (mistake.length === 0) { | ||
@@ -33,6 +33,6 @@ mistake = '[whitespace only]'; | ||
if (abort) { | ||
gutil.log('[' + guideline + '] ' + gutil.colors.white(tag + ": ") + gutil.colors.red(mistake) + " [Level: RED]"); | ||
gutil.log('[' + guideline + '] ' + gutil.colors.white(tag + ": ") + gutil.colors.red(mistake) + " [Level Red]"); | ||
errorBreak = true; | ||
} else { | ||
gutil.log('[' + guideline + '] ' + gutil.colors.white(tag + ": ") + gutil.colors.yellow(mistake)); | ||
gutil.log('[' + guideline + '] ' + gutil.colors.white(tag + ": ") + gutil.colors.yellow(mistake) + " [Level Orange]"); | ||
} | ||
@@ -102,3 +102,3 @@ } | ||
if (area.length > 0) { | ||
validationError('Wrong indentation on line ' + count, line, 'CI-FE-3003', false); | ||
validationError('Wrong indentation (line ' + count + '). Use auto formatter', line, 'CI-FE-3003', false); | ||
} | ||
@@ -145,5 +145,5 @@ } | ||
if (rule.includes(';;')) { | ||
validationError('Line contains double ";;"', rule, 'Warning', false); | ||
validationError('Line contains double ";;"', rule, 'CI-FE-WARNING', false); | ||
} else { | ||
validationError('Line countains multiple rules', rule, 'CI-FE-3004', true); | ||
validationError('Multi-Line CSS - Line countains multiple rules', rule, 'CI-FE-3004', true); | ||
} | ||
@@ -156,21 +156,4 @@ } | ||
if (prop.toLowerCase() !== prop) { | ||
validationError('CSS code must be written in lower case', rule, 'CI-FE-3003', true); | ||
validationError('All CSS code must be written in lower case', rule, 'CI-FE-3003', true); | ||
} | ||
// check that non-string values are lower case (except those in brackets) | ||
/*var value = rule.substr(rule.indexOf(':') + 1).replace(/^\s+|\s+$/g, ''); | ||
// font-family is special case since filenames might have capital letters | ||
if (prop.toLowerCase() !== 'font-family') { | ||
// strip urls and filepaths, since filenames might have capital letters | ||
if (value.indexOf('(') > 0) { | ||
value = value.substr(0, value.indexOf('(')) + value.substr(value.indexOf(')') + 1); | ||
if (value.toLowerCase() !== value) { | ||
validationError('CSS code must be written in lower case', rule, 'CI-FE-3003', true); | ||
} | ||
} | ||
}*/ | ||
// Disabled because some values require upper case | ||
} | ||
@@ -223,3 +206,3 @@ | ||
} else { | ||
validationError('Do not load resources from remote servers', path, 'CI-FE-1018a', false); | ||
validationError('External resources - Do not load resources from remote servers', path, 'CI-FE-1018a', false); | ||
} | ||
@@ -242,3 +225,3 @@ } | ||
if (line.indexOf('!important') > 0) { | ||
validationError('Usage of !important is (usually) not allowed (Line ' + count + ')', line, 'CI-FE-3009', false); | ||
validationError('Usage of !important is not allowed - in 99.9% of the cases (Line ' + count + ')', line, 'CI-FE-3009', false); | ||
} | ||
@@ -266,3 +249,3 @@ }); | ||
if (rule.substr(rule.indexOf(':') + 1).search(/\d+em/) > 0) { | ||
validationError('Use rem instead of em font size units', rule, 'CI-FE-3002', false); | ||
validationError('Font size unit - Use rem instead of em', rule, 'CI-FE-3002', false); | ||
} | ||
@@ -309,8 +292,6 @@ }); | ||
found = true; | ||
validationError('CSS classes must be written in lower case', check, 'CI-FE-3003', true); | ||
} | ||
if (check.indexOf('_') > 0) { | ||
validationError('All CSS code must be written in lower case', check, 'CI-FE-3003', true); | ||
} else if (check.indexOf('_') > 0) { | ||
found = true; | ||
validationError('CSS classes must be delimited with hyphens', check, 'CI-FE-3008', true); | ||
validationError('CSS classes should be delimited with hyphens (see Bootstrap style)', check, 'CI-FE-3008', false); | ||
} | ||
@@ -351,2 +332,5 @@ }); | ||
} | ||
if (typeof options.checkimportant !== 'boolean') { | ||
options.checkremote = true; | ||
} | ||
@@ -394,4 +378,4 @@ var errorOutputList = []; | ||
if (options.abortOnError && errorBreak) { | ||
gutil.log(gutil.colors.red("Critical validation error -> ABORT")); | ||
if (options.exitOnError && errorBreak) { | ||
gutil.log(gutil.colors.red("Critical validation error -> EXIT") + " (exitOnError is active)"); | ||
process.exit(1); | ||
@@ -398,0 +382,0 @@ } |
{ | ||
"name": "gulp-rb-validate-css", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Gulp plugin to validate CSS files according to Web Frontend Guidelines", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13026
306