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
pull/2814/head
Frans de Jonge 7 years ago committed by Qingping Hou
parent 495accfec9
commit b3a93d1456

@ -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

@ -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

@ -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

Loading…
Cancel
Save