mirror of
https://github.com/espressif/openthread.git
synced 2026-08-26 12:11:17 +00:00
[travis] check/fix EOF newline on pretty/pretty-check (#3671)
This commit is contained in:
@@ -35,7 +35,21 @@
|
||||
|
||||
set -x
|
||||
|
||||
die() {
|
||||
echo " *** ERROR: " $*
|
||||
exit 1
|
||||
}
|
||||
|
||||
# from `man diff`:
|
||||
# Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
|
||||
|
||||
$(dirname "$0")/clang-format.sh -style=file $@ | diff -u $@ -
|
||||
$(dirname "$0")/clang-format.sh -style=file $@ | diff -u $@ - || die
|
||||
|
||||
for arg; do true; done
|
||||
file=$arg
|
||||
[ -n "$(tail -c1 $file)" ] && {
|
||||
echo " *** ERROR: Missing EOF newline: " $file
|
||||
exit 1
|
||||
}
|
||||
|
||||
exit 0
|
||||
|
||||
+20
-1
@@ -48,4 +48,23 @@ else
|
||||
die "clang-format 6.0 required"
|
||||
fi
|
||||
|
||||
clang-format $@
|
||||
clang-format $@ || die
|
||||
|
||||
# ensure EOF newline
|
||||
REPLACE=no
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-i)
|
||||
REPLACE=yes
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
file=$arg
|
||||
|
||||
[ $REPLACE != yes ] || {
|
||||
[ -n "$(tail -c1 $file)" ] && echo >> $file
|
||||
}
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user