Browse Source

pre-commit: add error messages for style issues

sbg
Matthias Grob 5 years ago committed by Daniel Agar
parent
commit
5c0692e59e
  1. 4
      Tools/astyle/pre-commit

4
Tools/astyle/pre-commit

@ -31,7 +31,7 @@ if [ "$allownonascii" != "true" ] && @@ -31,7 +31,7 @@ if [ "$allownonascii" != "true" ] &&
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
echo "Error: Attempt to add a non-ascii file name."
echo "Pre-commit style error: Attempt to add a non-ascii file name."
echo
echo "This can cause problems if you want to work"
echo "with people on other platforms."
@ -49,6 +49,7 @@ fi @@ -49,6 +49,7 @@ fi
# If there are whitespace errors, print the offending file names and fail.
git diff-index --check --cached $against --
if [ $? -ne 0 ]; then
echo "Pre-commit style error: Whitespace issues"
exit 1
fi
@ -58,6 +59,7 @@ do @@ -58,6 +59,7 @@ do
./Tools/astyle/files_to_check_code_style.sh $i | xargs -n 1 -P 8 -I % ./Tools/astyle/check_code_style.sh %
if [ $? -ne 0 ]
then
echo "Pre-commit style error: Bad formatting according to astyle rules"
exit 1
fi
done

Loading…
Cancel
Save