summaryrefslogtreecommitdiff
path: root/bin/strict-bashism-check
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-03-23 20:18:01 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-03-23 20:18:01 +0100
commitc30de005f885202f24929bd4e3d3f5c885efbc0a (patch)
tree44b512356b80d3adad6521ad74f38ff9271f6c0d /bin/strict-bashism-check
parentff768f012bfef1bf264d06214aead70a58c0ff90 (diff)
parent497779257683e1c4ee2f2bf4c25687b34323c6be (diff)
downloadbuilder-c30de005f885202f24929bd4e3d3f5c885efbc0a.tar.xz
Merge branch 'master' into opcodes
Diffstat (limited to 'bin/strict-bashism-check')
-rwxr-xr-xbin/strict-bashism-check39
1 files changed, 28 insertions, 11 deletions
diff --git a/bin/strict-bashism-check b/bin/strict-bashism-check
index 3bb3884..cbf7e5b 100755
--- a/bin/strict-bashism-check
+++ b/bin/strict-bashism-check
@@ -49,37 +49,54 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
git archive "${tree}" | \
tar -C "${tmp_dir}" -x
+if ! cd "${tmp_dir}"; then
+ echo 'Cannot cd.'
+ exit 1
+fi
+
errors=$(
- cd "${tmp_dir}" || \
- echo 'Cannot cd.'
- find "bin" "conf" -type f -not -executable -not -name '.gitignore'
+ find bin conf lib -type f -not -executable -not -name '.gitignore'
)
if [ -n "${errors}" ]; then
- >&2 echo 'Non-executable files found in bin/ or conf/:'
+ >&2 echo 'Non-executable files found in bin/, conf/ or lib/:'
>&2 echo "${errors}"
exit 1
fi
errors=$(
-# shellcheck disable=SC2016
- find bin conf -type f -executable -exec grep -H '="\$(' {} \;
+ grep -r '\(\s\|^\)mysql buildmaster\($\|\s\)' bin lib conf
)
if [ -n "${errors}" ]; then
- >&2 echo 'Unnecessary quotes found:'
+ >&2 echo 'Style error: call "mysql_run_query" instead of "mysql buildmaster":'
>&2 echo "${errors}"
exit 1
fi
errors=$(
- cd "${tmp_dir}" || \
- echo 'Cannot cd.'
- shellcheck -x bin/* conf/* 2>&1
+# shellcheck disable=SC2016
+ find bin conf lib -type f -executable -exec grep -H '="\$(' {} \;
)
if [ -n "${errors}" ]; then
- >&2 echo 'shellcheck complains about the following:'
+ >&2 echo 'Unnecessary quotes found:'
>&2 echo "${errors}"
exit 1
fi
+
+if which shellcheck >/dev/null 2>&1; then
+ errors=$(
+ find bin conf lib \
+ -type f \
+ -not -name 'opcode_list' \
+ -not -name '.*' \
+ -exec shellcheck -x '{}' \; 2>&1
+ )
+
+ if [ -n "${errors}" ]; then
+ >&2 echo 'shellcheck complains about the following:'
+ >&2 echo "${errors}"
+ exit 1
+ fi
+fi