summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts/shellcheck.sh
blob: be24de5fcb56a947a152773df57cf5aa90dd4451 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

./autogen.sh
./configure --enable-debug --enable-gnfs --silent

find . -path ./.git -prune -o -path ./tests -prune -o -exec file {} \; \
  | grep "shell script" \
  | cut -d: -f 1 \
  | xargs shellcheck \
  >shellcheck.txt

SHELLCHECK_COUNT="$(grep -c 'In' shellcheck.txt)"

#fail build if there's any issue or warning
if [[ "$SHELLCHECK_COUNT" -gt 0 ]]; then
  echo ""
  echo "========================================================="
  echo "              Result of ShellCheck"
  echo "         Number of ShellCheck errors/warnings: ${SHELLCHECK_COUNT}"
  echo "========================================================="
  exit 1
fi