diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-08-07 13:38:54 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-08-07 13:38:54 -0700 |
| commit | 15d1edc449e6923fa4a6778c7ef96bd864598d8b (patch) | |
| tree | 8f0317744efa362c4f2a4e9c8114c77c52c8274d | |
| parent | 8732b2bcd2bb6953c0d01766b71ef68a0fac2453 (diff) | |
| download | nng-15d1edc449e6923fa4a6778c7ef96bd864598d8b.tar.gz nng-15d1edc449e6923fa4a6778c7ef96bd864598d8b.tar.bz2 nng-15d1edc449e6923fa4a6778c7ef96bd864598d8b.zip | |
Add ability to override clang format, including disable.
To disable check, specify CLANG_FORMAT as off, no, or skip.
| -rwxr-xr-x | etc/format-check.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/etc/format-check.sh b/etc/format-check.sh index b3e0da3f..c98ac586 100755 --- a/etc/format-check.sh +++ b/etc/format-check.sh @@ -14,11 +14,18 @@ # uncrustify.cfg located in the same directory as this script. It only handles # C language at this point. # +CLANG_FORMAT=${CLANG_FORMAT:-clang-format} +case "${CLANG_FORMAT}" in +no|off|skip|NO|OFF|SKIP) + echo "format checks skipped" + exit 0 + ;; +esac mydir=`dirname $0` srcdir=${mydir}/../src failed= -vers=$(clang-format -version) +vers=$(${CLANG_FORMAT} -version) if [ $? -ne 0 ]; then echo "clang format not found? Skipping checks." exit 0 @@ -53,7 +60,7 @@ mytmpdir=`mktemp -d` diffprog=${DIFF:-diff} if [ -t 1 ]; then - if colordiff -q /dev/null /dev/null; then + if colordiff -q /dev/null > /dev/null 2>&1; then diffprog=${DIFF:-colordiff} fi fi @@ -67,7 +74,7 @@ do # If we do not understand the format file, then do nothing # Our style requires a relatively modern clang-format, which is # older than is found on some Linux distros. - clang-format -fallback-style=none -style=file ${oldf} > ${newf} + ${CLANG_FORMAT} -fallback-style=none -style=file ${oldf} > ${newf} cmp -s ${oldf} ${newf} if [ $? -ne 0 ] then |
