Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit code 1 for warnings (warning vs error handling) #348

Open
ashtonian opened this issue May 22, 2024 · 2 comments
Open

Exit code 1 for warnings (warning vs error handling) #348

ashtonian opened this issue May 22, 2024 · 2 comments

Comments

@ashtonian
Copy link

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.

@chdsbd
Copy link
Collaborator

chdsbd commented May 23, 2024

I think we report all violations as warnings:

squawk/cli/src/reporter.rs

Lines 393 to 402 in 6437c3c

ReportViolation {
file: filename.into(),
line: lineno,
column: col,
level: ViolationLevel::Warning,
messages: violation.messages,
rule_name: violation.kind,
sql: problem_sql.into(),
}
})

Maybe we could mimic eslint's exit codes.

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

@iloveitaly
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants