diff options
-rwxr-xr-x | sanity-check.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sanity-check.sh b/sanity-check.sh index bfbd5d51..1a3da79c 100755 --- a/sanity-check.sh +++ b/sanity-check.sh @@ -1,5 +1,17 @@ #!/bin/bash -set -eu -o pipefail +set -euf -o pipefail + +# Usage: +# Check all scripts in this folder: +# ./sanity-check.sh +# Check specific files: +# ./sanity-check.sh script1.sh script2.sh + +if [[ "$#" -eq 0 ]]; then + files=($(find "$(dirname "$0")" -name "*.sh")) +else + files=("${@}") +fi #TODO: newer versions of shellcheck can set a minimum message level ignored=( @@ -18,4 +30,4 @@ ignored=( -e SC2031 # baseline_branch was modified in a subshell. That change might be lost. ) -shellcheck "$(dirname "$0")"/*.sh "${ignored[@]}" +shellcheck "${files[@]}" "${ignored[@]}" |