From cc5df7bf9c44828219eaae6d6de111d4603e19a7 Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Wed, 31 Jul 2019 10:49:36 +0200 Subject: lint(scripts): apply shellcheck suggestions on dhall checking script --- scripts/dhall_check.sh | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'scripts') diff --git a/scripts/dhall_check.sh b/scripts/dhall_check.sh index a3413ec..5a1ee1b 100755 --- a/scripts/dhall_check.sh +++ b/scripts/dhall_check.sh @@ -1,25 +1,19 @@ #!/usr/bin/env bash -pushd () { - command pushd "$@" > /dev/null -} - -popd () { - command popd "$@" > /dev/null -} +set -eo pipefail go() { - local ERROR=0; - for file in $(find -type f -name "*.dhall"); do - pushd $(dirname $file); - cat $(basename $file) | dhall --explain resolve > /dev/null; + local ERROR=0 + while IFS= read -r -d '' file + do + cd "$(dirname "$file")" || exit echo "Typechecking ${file}" - if [ "$?" -ne "0" ]; then + if ! dhall --explain resolve < "$(basename "$file")" >/dev/null; then echo "Failed to resolve $file" - ERROR=1; + ERROR=1 fi; - popd; - done; + cd - >/dev/null || exit + done < <(find . -type f -name "*.dhall" -print0) exit $ERROR; } -- cgit v1.2.3