mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
clang-format: fix counter increment & output (#5456)
clang-format: fix bash syntax on increment
This commit is contained in:
parent
aa5549ecc3
commit
72ce9d7a5d
@ -4,6 +4,7 @@
|
|||||||
needs_compile || exit 0
|
needs_compile || exit 0
|
||||||
|
|
||||||
function perform_lint() {
|
function perform_lint() {
|
||||||
|
echo "Performing LINT..."
|
||||||
CLANG_FORMAT=clang-format-3.9
|
CLANG_FORMAT=clang-format-3.9
|
||||||
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
|
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
|
||||||
# Get list of every file modified in this pull request
|
# Get list of every file modified in this pull request
|
||||||
@ -17,13 +18,15 @@ function perform_lint() {
|
|||||||
local fail=0
|
local fail=0
|
||||||
for f in ${files_to_lint}; do
|
for f in ${files_to_lint}; do
|
||||||
d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
|
d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
|
||||||
|
|
||||||
if ! [ -z "$d" ]; then
|
if ! [ -z "$d" ]; then
|
||||||
((errorcount++))
|
errorcount=$((errorcount+1))
|
||||||
printf "The file %s is not compliant with the coding style:\n%s\n" "$f" "$d"
|
|
||||||
|
printf "The file %s is not compliant with the coding style" "$f"
|
||||||
if [ ${errorcount} -gt 50 ]; then
|
if [ ${errorcount} -gt 50 ]; then
|
||||||
printf "Too many errors encountered previously, this diff is hidden.\n"
|
printf "\nToo many errors encountered previously, this diff is hidden.\n"
|
||||||
else
|
else
|
||||||
printf "%s\n" "$d"
|
printf ":\n%s\n" "$d"
|
||||||
fi
|
fi
|
||||||
# Disable build failure at this moment as we need to have a complete MT source whitelist to check
|
# Disable build failure at this moment as we need to have a complete MT source whitelist to check
|
||||||
fail=0
|
fail=0
|
||||||
@ -31,15 +34,15 @@ function perform_lint() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "$fail" = 1 ]; then
|
if [ "$fail" = 1 ]; then
|
||||||
|
echo "LINT reports failure."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$LINT" == "1" ]]; then
|
if [[ "$LINT" == "1" ]]; then
|
||||||
# Lint with exit CI
|
# Lint with exit CI
|
||||||
perform_lint
|
perform_lint
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $PLATFORM == "Unix" ]]; then
|
if [[ $PLATFORM == "Unix" ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user