BetaDeveloper
Exit codes
A reference for the exit codes the SonarQube CLI returns, so you can integrate it into scripts, CI/CD jobs, and Git hooks.
Code
Meaning
How to use these in scripts
Treat findings as a failure
sonar analyze secrets src/
# Step fails if secrets are present (exit 51), passes otherwise.Distinguish "no findings" from "command broke"
sonar analyze --staged
case $? in
0) echo "Clean — no new issues." ;;
51) echo "Issues found, but analysis succeeded." ;;
*) echo "Analysis failed (exit $?)."; exit 1 ;;
esacTolerate Ctrl+C cleanly
Ctrl+C cleanlyRelated pages
Last updated
Was this helpful?

