shellcheck --severity: Tune Failure Level
shellcheck --severity sets the lowest level it reports: error, warning (default), info, or style.
Severity decides how strict the gate is. Start loose on a legacy script set, then ratchet the level down to catch more.
What it does
Each ShellCheck finding has a severity: error, warning, info, or style. --severity NAME reports that level and anything more severe, and lower levels are hidden. The default is warning. You can also set severity in .shellcheckrc.
Common usage
# only fail on the most serious problems
shellcheck --severity=error script.sh
# report everything down to stylistic notes
shellcheck --severity=style script.sh
# .shellcheckrc
# severity=warningLevels
| Severity | What it covers |
|---|---|
| error | Almost certainly a bug (e.g. SC2086 in unsafe spots) |
| warning | Likely a problem; the default threshold |
| info | Worth knowing, lower risk |
| style | Stylistic suggestions |
| (in .shellcheckrc) | severity=warning sets the project default |
In CI
Adopting ShellCheck on an existing repo is smoother starting at --severity=error to fix real bugs first, then tightening to warning and below over time. Note severity only filters which findings show; it does not change that any reported finding still exits non-zero.
Common errors in CI
A run that "passes" but you expected findings often has --severity set too high, hiding warning and info results. Conversely, dropping to --severity=style can flood CI with low-value notes; pair it with --exclude for the noisy codes.