# bash/shellcheck

> Runs ShellCheck over shell scripts and sourced files, with its stable optional rules at level all.

Runs ShellCheck over shell scripts and sourced files, with its stable optional rules at level all.

Part of the [`bash`](/reference/configurations/bash/) configuration, at the `recommended` [level](/start/concepts/#levels). It runs at the `commit` [stage](/start/concepts/#stage), per file. It runs shellcheck.

## Why

ShellCheck catches the quoting, globbing, and exit-status mistakes that make a script fail on the one input nobody tested.

## 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

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

Turn it off for some files, or one of its lint rules, with a reason:

```shell
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:

```text
# shellcheck disable=SC2086 # reason: the word splitting is wanted here
```
