bash/shellcheck
Runs ShellCheck over shell scripts and sourced files, with its stable optional rules at level all.
Part of the bash configuration, at the recommended level. It runs at the commit stage, per file. It runs shellcheck.
ShellCheck catches the quoting, globbing, and exit-status mistakes that make a script fail on the one input nobody tested.
What to do
Section titled “What to do”Read the SC code in the finding; gspot explain shellcheck/SC2086 links to its page. Turn one code off with gspot ignore bash/shellcheck --rule SC2086 --reason "<why>".
Example
Section titled “Example”In a Bash script, printf "%s\n" $name reports SC2086 because the expansion permits word splitting and globbing. Use printf "%s\n" "$name" to pass the value as one argument.
Turn it off
Section titled “Turn it off”Turn it off for some files, or one of its lint rules, with a reason:
gspot ignore bash/shellcheck --paths "<glob>" --reason "<why>"gspot ignore bash/shellcheck --rule <rule> --reason "<why>"To silence one place, write a comment such as:
# shellcheck disable=SC2086 # reason: the word splitting is wanted here