Skip to content

Exit Codes

What exit codes the CLI returns and what they mean.

Code Meaning
0 Success. No findings above the --fail-on threshold.
1 Findings above the --fail-on threshold.
2 Configuration or rule error (parse, schema, or compile error).
6 License error. License file is missing, expired, tampered with, or not valid for this CLI version. See License File.

--fail-on and Exit Code 1

codecharter analyze MySolution.sln --fail-on error
codecharter analyze MySolution.sln --fail-on warn
codecharter analyze MySolution.sln --fail-on info
Value Exit code 1 when
error at least one error finding
warn at least one warn or error finding
info at least one finding at all

Without --fail-on the CLI always returns exit code 0 as long as no configuration error occurs.

Examples in CI Shells

GitHub Actions

- name: CodeCharter
  run: codecharter analyze MySolution.sln --fail-on error
  # Exit code 1 turns the step red, GitHub stops the job.

Bash — reading exit codes

codecharter analyze MySolution.sln --fail-on error
code=$?
case $code in
  0) echo "ok" ;;
  1) echo "findings over threshold" ;;
  2) echo "regel-syntax kaputt" ;;
esac