bash/script-layout
Checks each Bash script for a shebang, strict mode, a final main call when it defines functions, declarative libraries, and removed temporary files.
Part of the bash configuration, at the all level. It runs at the commit stage, per file. gspot runs this check itself.
A script that skips strict mode or hides its runtime fails silently on the machine that matters.
What to do
Section titled “What to do”Open with the shebang and run set -euo pipefail first. When an executable defines functions, end it with a call to main.
Example
Section titled “Example”An executable Bash script without set -euo pipefail reports a finding. Put that line before the first command, and when the script defines functions, call main last.
Turn it off
Section titled “Turn it off”Turn it off for some files, with a reason:
gspot ignore bash/script-layout --paths "<glob>" --reason "<why>"