mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Note: Some files are autogenerated and I did not yet go through each source of generation to fix it there. Instead I adjusted the filter to only exclude those such that we can fix things in steps.
20 lines
764 B
Bash
Executable File
20 lines
764 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
return_value=0
|
|
|
|
# Check if there are files checked in that don't end in a newline (POSIX requirement)
|
|
git grep --cached -Il '' -- ':!docs/public/' ':!docs/ko/' ':!docs/uk/' ':!docs/zh/' | xargs -L1 bash -c 'if test "$(tail -c 1 "$0")"; then echo "No new line at end of $0"; exit 1; fi'
|
|
|
|
if [ $? -ne 0 ]; then
|
|
return_value=1
|
|
fi
|
|
|
|
# Check if there are files checked in that have duplicate newlines at the end (fail trailing whitespace checks)
|
|
git grep --cached -Il '' -- ':!docs/public/' ':!docs/ko/' ':!docs/uk/' ':!docs/zh/' | xargs -L1 bash -c 'if tail -c 2 "$0" | ( read x && read y && [ x"$x" = x ] && [ x"$y" = x ]); then echo "Multiple newlines at the end of $0"; exit 1; fi'
|
|
|
|
if [ $? -ne 0 ]; then
|
|
return_value=1
|
|
fi
|
|
|
|
exit $return_value
|