From 88661eb6f37f2a1015f3289c5ba656ffc2b15a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Thu, 7 May 2020 08:59:14 +0200 Subject: [PATCH] Add run-shellcheck helper --- run-shellcheck.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 run-shellcheck.sh diff --git a/run-shellcheck.sh b/run-shellcheck.sh new file mode 100755 index 0000000..c0532e0 --- /dev/null +++ b/run-shellcheck.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +SHELLCHECKCMD="shellcheck -s sh -f gcc -x" +# Skip SC2154 for variables starting with __ since such variables are cdist +# environment variables. +SHELLCHECK_SKIP=': __.*is referenced but not assigned.*\[SC2154\]' +SHELLCHECKTMP=".shellcheck.tmp" + +check () { + find type/ -type f $1 $2 -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" > "${SHELLCHECKTMP}" + test ! -s "${SHELLCHECKTMP}" || { cat "${SHELLCHECKTMP}"; exit 1; } +} + +check -path "*/explorer/*" +check -path "*/files/*" +check -name manifest +check -name gencode-local +check -name gencode-remote