summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts
diff options
context:
space:
mode:
authorDeepshikha khandelwal <dkhandel@redhat.com>2018-11-16 12:18:33 +0530
committerAmar Tumballi <amarts@redhat.com>2019-04-11 04:01:30 +0000
commit68db52030ab9547742329805444bdd458526dadc (patch)
tree173cfdd9be17654008bc6f6b2b5983d399710022 /build-gluster-org/scripts
parent50a78802c62a3716ce9cde23bbd6e5116f4dbe6c (diff)
Non-voting job to validate shell script using ShellCheck tool
Change-Id: If0077909dd7e2b734f551c53e230a03c65265350
Diffstat (limited to 'build-gluster-org/scripts')
-rw-r--r--build-gluster-org/scripts/shellcheck.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/build-gluster-org/scripts/shellcheck.sh b/build-gluster-org/scripts/shellcheck.sh
new file mode 100644
index 0000000..f5e2278
--- /dev/null
+++ b/build-gluster-org/scripts/shellcheck.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+./autogen.sh
+./configure --disable-bd-xlator --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