From b3a93d1456de33e0fed7a1395c5226af0f90bb62 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Thu, 27 Apr 2017 10:25:17 +0200 Subject: [PATCH] Travis: update shfmt to v1.3.0 (#2821) * Travis: update shfmt to v1.3.0 * better error message * fix kodev problem & fix slightly broken formatting --- .ci/helper_shellchecks.sh | 5 +++++ .ci/install.sh | 4 ++-- kodev | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.ci/helper_shellchecks.sh b/.ci/helper_shellchecks.sh index 3956a49ab..d7bc0dd94 100755 --- a/.ci/helper_shellchecks.sh +++ b/.ci/helper_shellchecks.sh @@ -13,6 +13,11 @@ for shellscript in "${shellscript_locations[@]}"; do echo -e "${ANSI_GREEN}Running shellcheck on ${shellscript}" shellcheck "${shellscript}" || SHELLSCRIPT_ERROR=1 echo -e "${ANSI_GREEN}Running shfmt on ${shellscript}" + if ! shfmt -i 4 "${shellscript}" >/dev/null 2>&1; then + echo -e "${ANSI_RED}Warning: ${shellscript} contains the following problem:" + shfmt -i 4 "${shellscript}" || SHELLSCRIPT_ERROR=1 + continue + fi if [ "$(cat "${shellscript}")" != "$(shfmt -i 4 "${shellscript}")" ]; then echo -e "${ANSI_RED}Warning: ${shellscript} does not abide by coding style, diff for expected style:" shfmt -i 4 "${shellscript}" | diff "${shellscript}" - || SHELLSCRIPT_ERROR=1 diff --git a/.ci/install.sh b/.ci/install.sh index 5ba25a208..117d1822f 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -52,8 +52,8 @@ else fi # install shfmt -SHFMT_URL="https://github.com/mvdan/sh/releases/download/v1.2.0/shfmt_v1.2.0_linux_amd64" -if ! command -v shfmt; then +SHFMT_URL="https://github.com/mvdan/sh/releases/download/v1.3.0/shfmt_v1.3.0_linux_amd64" +if [ "$(shfmt --version)" != "v1.3.0" ]; then curl -sSL "${SHFMT_URL}" -o "${HOME}/bin/shfmt" chmod +x "${HOME}/bin/shfmt" else diff --git a/kodev b/kodev index ea37dc937..457c75498 100755 --- a/kodev +++ b/kodev @@ -462,14 +462,15 @@ OPTIONS: -o "./spec/${target}/unit/verbose_print" \ --coverage \ --exclude-tags=nocov "${test_path}" || { - echo "Failed to run tests!" && exit 1 - } + echo "Failed to run tests!" && exit 1 + } fi if [ ${show_full} -eq 1 ]; then cat luacov.report.out else + LUACOV_REPORT_SUMMARY=$(grep -nm1 -e '^Summary$' luacov.report.out | cut -d: -f1) tail -n \ - +$(($(grep -nm1 -e '^Summary$' luacov.report.out | cut -d: -f1) - 1)) \ + +$((LUACOV_REPORT_SUMMARY - 1)) \ luacov.report.out fi } || exit