webhintio / hint

💡 A hinting engine for the web
https://webhint.io/
Apache License 2.0
3.62k stars 670 forks source link

[Feature] CLI option for exit code 0 only for hint errors or webhint failures #4381

Open masi opened 3 years ago

masi commented 3 years ago

🚀 Feature request

Description

I would like to make webhint exit with a non-zero exit code only when either at least one hint has the severity "error" or webhint has a failure condition so it cannot run all tests.

The icing would be to set up a minimum severity to trigger a non-zero exit code, eg warning.

What scenarios will this solve?

In a CI I don't have to disable low severity hints completely to have a CI step pass or make the step pass regardless of the results of the webhint's run.

molant commented 3 years ago

I'm looking at the code and by default the CLI should be exiting with non-zero when there are at least 1 error. What is the configuration that you are using? Maybe we are overriding it in there?

I think you can do what you want by using the severityThreshold property in your .hintrc. I'm not sure why it's not documented in the website though (probably my bad as I was the one implementing that feature 😓)