summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-21 10:42:44 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-21 10:42:44 -0800
commitf69883d0ed5d48e78e9e658abc145bc1aeb79279 (patch)
tree43eea765a18cf18c5658cea72015438ddb37ff66 /etc
parent2dc0f7aaabefc99e8ee26e411f628d80ee45fb7b (diff)
downloadnng-f69883d0ed5d48e78e9e658abc145bc1aeb79279.tar.gz
nng-f69883d0ed5d48e78e9e658abc145bc1aeb79279.tar.bz2
nng-f69883d0ed5d48e78e9e658abc145bc1aeb79279.zip
Another attempt at uncrustify checks.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/uncrustify_check.sh41
1 files changed, 28 insertions, 13 deletions
diff --git a/etc/uncrustify_check.sh b/etc/uncrustify_check.sh
index c51e8880..fc299650 100755
--- a/etc/uncrustify_check.sh
+++ b/etc/uncrustify_check.sh
@@ -1,23 +1,38 @@
#!/bin/sh
+#
+# Copyright 2016 Garrett D'Amore <garrett@damore.org>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+#
+#
+# This script is used to run uncrustify and report files that don't match.
+# It looks for .c and .h files, located in ../src, and uses the config file
+# uncrustify.cfg located in the same directory as this script. It only handles
+# C language at this point.
+#
mydir=`dirname $0`
srcdir=${mydir}/../src
-uncrustify --version
-PATH=${PATH}:/opt/pkg/bin export PATH
-stat=0
+failed=
-find ${srcdir} -name '*.[ch]' -print | while read file
+for file in `find ${srcdir} -name '*.[ch]' -print`
do
- uncrustify -c "${mydir}/uncrustify.cfg" -lC -f $file | colordiff -u $file -
- if [ $? -ne 0 ]
- then
- stat=1
+ uncrustify -c "${mydir}/uncrustify.cfg" -q -lC $file
+ if [ $? -ne 0 ]; then
+ echo "Cannot run uncrustify??" 1>&2
+ exit 2
fi
+ colordiff -u $file $file.uncrustify
+ if [ $? -ne 0 ]; then
+ failed=1
+ fi
+ rm ${file}.uncrustify
done
-
-if [ $stat -ne 0 ]
+if [ -n "$failed" ]
then
- echo "Format errors detect. Please fix."
- exit 1
+ echo "Uncrustify differences found!" 1>&2
+ exit 2
fi
-exit 0