squawk icon indicating copy to clipboard operation
squawk copied to clipboard

Exit code 1 for warnings (warning vs error handling)

Open ashtonian opened this issue 1 year ago • 2 comments

It would be nice if the handling around warnings and errors was more configurable ie --errors-only or --warnings-as-errors=true/false. Right now it returns an exit code 1 when there is just warnings which is treating warnings as errors. A flag would be nice.

ashtonian avatar May 22 '24 21:05 ashtonian

I think we report all violations as warnings:

https://github.com/sbdchd/squawk/blob/6437c3ca743d07f3c7ce8ebe49240b2c5aa65c1c/cli/src/reporter.rs#L393-L402

Maybe we could mimic eslint's exit codes.

  • no violations: exit 0
  • violations: exit 1
  • internal error (parsing error, some unknown error): exit 2

chdsbd avatar May 23 '24 01:05 chdsbd

Strong agree here. Especially if you are doing something like this in your CI run this causes builds to fail. The easy option here is another CLI flag to enable warnings to fail with a non-zero exit code.

iloveitaly avatar Dec 01 '24 13:12 iloveitaly