grunt-scss-lint icon indicating copy to clipboard operation
grunt-scss-lint copied to clipboard

How to get Grunt not to fail the whole task if only warnings but no errors were found

Open LorenzKahl opened this issue 9 years ago • 6 comments
trafficstars

When running my scss-lint task I get some warnings but no errors and the following output:

Warning: Task "scsslint:allFiles" failed. Use --force to continue.
Error: Task "scsslint:allFiles" failed.
    at Task.<anonymous> (/<path>/node_modules/grunt/lib/util/task.js:205:15)
    at null._onTimeout (/<path>/node_modules/grunt/lib/util/task.js:241:33)
    at Timer.listOnTimeout (timers.js:119:15)

I already had a look at https://github.com/brigade/scss-lint/blob/master/lib/scss_lint/cli.rb So, as of my understanding the exit code of the scss-lint gem would be 1.

I would like Grunt to continue if there are no errors. Any advice on how to achieve this?

My Grunt task looks like this:

...
scsslint: {
    allFiles: scssFilePattern,
    options: {
        config: '.scss-lint.yml',
        colorizeOutput: true,
        emitError: false,
        compact: false,
    },
}, // end of scsslint
...

LorenzKahl avatar Dec 30 '15 17:12 LorenzKahl

Run the task with --stack --debug please.

ahmednuaman avatar Jan 01 '16 09:01 ahmednuaman

Thanks, but the relevant output is the same.

LorenzKahl avatar Jan 04 '16 10:01 LorenzKahl

Here's an abbreviated version of the output – I deliberately left out all the linter-warnings.

$ grunt scsslint --stack --debug
Running "scsslint:allFiles" (scsslint) task
[D] Task source: /<projectpath>/node_modules/grunt-scss-lint/tasks/scss-lint.js
Running scss-lint on allFiles
[D] Run command: scss-lint -c .scss-lint.yml _global_css/_scss/_c-tp-checklist.scss _global_css/_scss/_c-tp-copytext.scss _global_css/_scss/_c-tp-downloadbutton.scss _global_css/_scss/_c-tp-easylist.scss _global_css/_scss/_c-tp-fleximage.scss _global_css/_scss/_c-tp-footnotelist.scss _global_css/_scss/_c-tp-formelement.scss _global_css/_scss/_c-tp-headline.scss _global_css/_scss/_c-tp-message.scss _global_css/_scss/_c-tp-orderedlist.scss _global_css/_scss/_c-tp-separatorline.scss 
...
<a lot of other linter-warnings> 
...
_global_css/_scss/_m-tp-textblock.scss:90 [W] TrailingZero: `1.500` should be written without a trailing zero as `1.50`
Warning: Task "scsslint:allFiles" failed. Use --force to continue.
Error: Task "scsslint:allFiles" failed.
    at Task.<anonymous> (/<projectpath>/node_modules/grunt/lib/util/task.js:205:15)
    at null._onTimeout (/<projectpath>/node_modules/grunt/lib/util/task.js:241:33)
    at Timer.listOnTimeout (timers.js:119:15)

LorenzKahl avatar Jan 04 '16 10:01 LorenzKahl

Any progress?

ahmednuaman avatar Jul 05 '16 15:07 ahmednuaman

@LorenzKahl I think PR #138 will help with this.

nick11703 avatar Jul 12 '16 16:07 nick11703

@nick11703 great - I will have a look. Thanks for letting me know.

LorenzKahl avatar Jul 12 '16 16:07 LorenzKahl