We use the go language environment since it's required by shfmt, this saves us from having to install go ourselves.
Linters or Static Code Analyzers will check the programs source code for bugs, errors, and formatting issues.
Static Code Analysis Satisfies the ITSG33 Control SA-11(1) Static Code Analysis
Use ShellCheck
to check your bash/sh for known issues.
Link to tool: ShellCheck GitHub Page
To simplify installation of this tool we are running it from inside a docker container
docker run --rm -v "$PWD:/mnt" koalaman/shellcheck:stable script-to-test.sh
Use shfmt
to ensure your script is formatted using a standard format. We are
using the
Google Shell Style Guide
to format our scripts.
Link to tool: shfmt GitHub Page
Unfortunately we cannot run shfmt from within a docker container as the diff functionality currently doesn't work
shfmt -d -i 2 -ci -w script-to-test.sh