summaryrefslogtreecommitdiff
path: root/sanity-check.sh
blob: 51bc4e15164ed48ee908cdfb4db0bb0860ff4a29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
set -euf -o pipefail

# Usage:
# Check all scripts in the current working directory
# ./sanity-check.sh
# Check specific files
# ./sanity-check.sh script1.sh script2.sh

if [[ "$#" -eq 0 ]]; then
  files=()
  while IFS='' read -r line; do files+=("$line"); done < <(\
    find . -name "*.sh" -o -name "*.job")
else
  files=("${@}")
fi

# Assuming shellcheck >= 0.7.0
shellcheck "${files[@]}" --severity=warning