aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml3
-rwxr-xr-xetc/uncrustify_check.sh41
2 files changed, 29 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml
index b1bfe0f1..c457e816 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,5 +30,4 @@ script:
- cmake ..
- cmake --build . -- -j4
- ctest --output-on-failure -C Debug -j4
- - cd ..
- - ./etc/uncrustify_check.sh
+ - ../etc/uncrustify_check.sh
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