ahmednuaman / grunt-scss-lint

A Grunt task to lint your SCSS
MIT License
141 stars 35 forks source link

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

Open LorenzKahl opened 8 years ago

LorenzKahl commented 8 years ago

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
...
ahmednuaman commented 8 years ago

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

LorenzKahl commented 8 years ago

Thanks, but the relevant output is the same.

LorenzKahl commented 8 years ago

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)
ahmednuaman commented 8 years ago

Any progress?

nick11703 commented 8 years ago

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

LorenzKahl commented 8 years ago

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