pre-commit: add error messages for style issues

This commit is contained in:
Matthias Grob
2019-11-02 09:49:46 -04:00
committed by Daniel Agar
parent 933ff8d480
commit 5c0692e59e
+3 -1
View File
@@ -31,7 +31,7 @@ if [ "$allownonascii" != "true" ] &&
test $(git diff --cached --name-only --diff-filter=A -z $against | test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then 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
echo "This can cause problems if you want to work" echo "This can cause problems if you want to work"
echo "with people on other platforms." echo "with people on other platforms."
@@ -49,6 +49,7 @@ fi
# If there are whitespace errors, print the offending file names and fail. # If there are whitespace errors, print the offending file names and fail.
git diff-index --check --cached $against -- git diff-index --check --cached $against --
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Pre-commit style error: Whitespace issues"
exit 1 exit 1
fi fi
@@ -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 % ./Tools/astyle/files_to_check_code_style.sh $i | xargs -n 1 -P 8 -I % ./Tools/astyle/check_code_style.sh %
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Pre-commit style error: Bad formatting according to astyle rules"
exit 1 exit 1
fi fi
done done