grunt-lesshint
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -77,4 +77,8 @@ /* | ||
options: { | ||
spaceAfterPropertyColon: 'no_space', | ||
spaceBeforeBrace: 'no_space' | ||
spaceAfterPropertyColon: { | ||
style: 'no_space' | ||
}, | ||
spaceBeforeBrace: { | ||
style: 'no_space' | ||
} | ||
}, | ||
@@ -107,2 +111,25 @@ files: { | ||
} | ||
}, | ||
allowWarnings: { | ||
options: { | ||
allowWarnings: true, | ||
spaceAfterPropertyColon: { | ||
style: 'one_space' | ||
} | ||
}, | ||
files: { | ||
src: [ 'test/fixtures/warnings.less' ] | ||
} | ||
}, | ||
allowWarningsWithError: { | ||
options: { | ||
allowWarnings: true, | ||
spaceAfterPropertyColon: { | ||
style: 'one_space', | ||
severity: "error" | ||
} | ||
}, | ||
files: { | ||
src: [ 'test/fixtures/warnings.less' ] | ||
} | ||
} | ||
@@ -109,0 +136,0 @@ }, |
{ | ||
"name": "grunt-lesshint", | ||
"description": "Lint lesscss files with grunt", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"homepage": "https://github.com/lesshint/grunt-lesshint", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -96,2 +96,8 @@ # grunt-lesshint | ||
#### allowWarnings | ||
Type: `Boolean` | ||
Default value: `false` | ||
Set `allowWarnings` to `true` to allow the task to succeed if only warnings occur. | ||
## Contributing | ||
@@ -103,2 +109,3 @@ In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). | ||
|---|---|---| | ||
|2016-10-10|1.4.0|Added support for allowing warnings without exiting. Thanks [@mmckenziedev](https://github.com/mmckenziedev)!| | ||
|2016-09-22|1.3.0|Added support for custom reporters. Thanks [@scttdavs](https://github.com/scttdavs)!| | ||
@@ -105,0 +112,0 @@ |2016-09-05|1.2.0|<ul><li>Update grunt to 1.0.0</li><li>Update lesshint to 2.0.0</li><li>Added node 6.* to Travis</li></ul>| |
@@ -40,2 +40,3 @@ /* | ||
cleanFileCount = 0, | ||
warningCount = 0, | ||
response; | ||
@@ -58,3 +59,9 @@ | ||
errorFileCount += 1; | ||
errorCount += output.length; | ||
output.forEach(function (reportObject) { | ||
if (reportObject.severity === "error") { | ||
errorCount = errorCount + 1; | ||
} else { | ||
warningCount = warningCount + 1; | ||
} | ||
}); | ||
} else { | ||
@@ -67,6 +74,11 @@ // use built in reporter | ||
grunt.log.subhead( ' ' + filepath ); | ||
output.forEach( function( errorObject ){ | ||
errorCount = errorCount + 1; | ||
grunt.log.writeln( ' ' + errorObject.line + ' | ' + chalk.gray( inputArray[ errorObject.line - 1 ] ) ); | ||
grunt.log.writeln( grunt.util.repeat( errorObject.column + 7, ' ' ) + '^ ' + errorObject.message ); | ||
output.forEach(function (reportObject) { | ||
if (reportObject.severity === "error") { | ||
errorCount = errorCount + 1; | ||
} else { | ||
warningCount = warningCount + 1; | ||
} | ||
grunt.log.writeln( ' ' + reportObject.line + ' | ' + chalk.gray( inputArray[ reportObject.line - 1 ] ) ); | ||
grunt.log.writeln( grunt.util.repeat( reportObject.column + 7, ' ' ) + '^ ' + reportObject.message ); | ||
}); | ||
@@ -85,4 +97,7 @@ | ||
if( errorCount > 0 ){ | ||
response = errorCount + grunt.util.pluralize( errorCount, ' error in / errors in ' ) + errorFileCount + grunt.util.pluralize( errorFileCount, ' file/ files' ); | ||
if (warningCount > 0 || errorCount > 0) { | ||
response = | ||
warningCount + grunt.util.pluralize(errorCount, ' warning/ warnings') + | ||
" and " + errorCount + grunt.util.pluralize(errorCount, ' error in / errors in ') + | ||
errorFileCount + grunt.util.pluralize(errorFileCount, ' file/ files'); | ||
@@ -97,3 +112,7 @@ if( cleanFileCount > 0 ){ | ||
success = false; | ||
if (options.allowWarnings === true && errorCount === 0) { | ||
success = true; | ||
} else { | ||
success = false; | ||
} | ||
} else { | ||
@@ -100,0 +119,0 @@ grunt.log.ok( cleanFileCount + grunt.util.pluralize( cleanFileCount, ' file / files ' ) + 'without linting errors.' ); |
@@ -72,2 +72,22 @@ 'use strict'; | ||
}); | ||
describe( 'allowWarnings', function(){ | ||
var response = spawnSync( 'node', [ gruntPath, 'lesshint:allowWarnings' ], { | ||
encoding: 'utf8' | ||
}); | ||
it( 'This assertion should succeed and exit with status code 0 (No errors!)', function(){ | ||
assert.equal( response.status, 0 ); | ||
}); | ||
}); | ||
describe( 'allowWarningsWithError', function(){ | ||
var response = spawnSync( 'node', [ gruntPath, 'lesshint:allowWarningsWithError' ], { | ||
encoding: 'utf8' | ||
}); | ||
it( 'This assertion should exit with status code 3 (Task error)', function(){ | ||
assert.equal( 3, response.status ); | ||
} ); | ||
}); | ||
}); |
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
20155
11
328
139