forked from Archive/PX4-Autopilot
pre-commit hook: show all style issues, not just the ones from the first file
This commit is contained in:
parent
2716ce7a56
commit
6938d24ec7
|
@ -1,12 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
PATTERN="-e ."
|
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
|
||||||
PATTERN="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec find boards msg src platforms test \
|
exec find boards msg src platforms test \
|
||||||
-path msg/templates/urtps -prune -o \
|
-path msg/templates/urtps -prune -o \
|
||||||
-path platforms/nuttx/NuttX -prune -o \
|
-path platforms/nuttx/NuttX -prune -o \
|
||||||
|
@ -27,4 +21,4 @@ exec find boards msg src platforms test \
|
||||||
-path src/lib/crypto/monocypher -prune -o \
|
-path src/lib/crypto/monocypher -prune -o \
|
||||||
-path src/lib/crypto/libtomcrypt -prune -o \
|
-path src/lib/crypto/libtomcrypt -prune -o \
|
||||||
-path src/lib/crypto/libtommath -prune -o \
|
-path src/lib/crypto/libtommath -prune -o \
|
||||||
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) | grep $PATTERN
|
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \)
|
||||||
|
|
|
@ -54,12 +54,9 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for code style, only in changed files
|
# Check for code style, only in changed files
|
||||||
for i in `git diff --cached --name-only --diff-filter=ACM`
|
bash -c "comm -12 <(./Tools/astyle/files_to_check_code_style.sh | sort) <(git diff --cached --name-only --diff-filter=ACM) | xargs -P 8 -I % ./Tools/astyle/check_code_style.sh %"
|
||||||
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 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "Pre-commit style error: Bad formatting according to astyle rules"
|
echo "Pre-commit style error: Bad formatting according to astyle rules"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in New Issue