diff options
Diffstat (limited to 'etc')
| -rwxr-xr-x | etc/uncrustify_check.sh | 41 |
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 |
