Skip to content

Linting / code style

  • for general shell linting, use shuck or shellcheck`
  • for bash, use checkbashism
    • see bash.md for more details on bashism
  • Also: shfmt

shuck

Shellcheck

Ignoring

Ignore a line:

# shellcheck disable=SC2086

Shellcheck fixing support

Still no native automitic fixing but as a workaround:

shellcheck -f diff test.sh |git apply

For multiple files:

find . -type f -iname '*.sh' -printf '%P\0' | xargs -0 shellcheck -f diff | git apply

There's also an example to use parallel jobs.

beautysh

Github