aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPaul Bonaud <paul.bonaud@fretlink.com>2019-07-31 10:49:36 +0200
committerPaul Bonaud <paul.bonaud@fretlink.com>2019-07-31 14:18:41 +0200
commitcc5df7bf9c44828219eaae6d6de111d4603e19a7 (patch)
tree42959db073ff88d2f5ddcd42ff97bc548d73bf05
parent2867b6f25aff418e0d8a3ca7c841ad443f98cb92 (diff)
downloadansible-clever-cc5df7bf9c44828219eaae6d6de111d4603e19a7.tar.gz
ansible-clever-cc5df7bf9c44828219eaae6d6de111d4603e19a7.tar.zst
ansible-clever-cc5df7bf9c44828219eaae6d6de111d4603e19a7.zip
lint(scripts): apply shellcheck suggestions on dhall checking script
-rwxr-xr-xscripts/dhall_check.sh24
1 files changed, 9 insertions, 15 deletions
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 @@
1#!/usr/bin/env bash 1#!/usr/bin/env bash
2 2
3pushd () { 3set -eo pipefail
4 command pushd "$@" > /dev/null
5}
6
7popd () {
8 command popd "$@" > /dev/null
9}
10 4
11go() { 5go() {
12 local ERROR=0; 6 local ERROR=0
13 for file in $(find -type f -name "*.dhall"); do 7 while IFS= read -r -d '' file
14 pushd $(dirname $file); 8 do
15 cat $(basename $file) | dhall --explain resolve > /dev/null; 9 cd "$(dirname "$file")" || exit
16 echo "Typechecking ${file}" 10 echo "Typechecking ${file}"
17 if [ "$?" -ne "0" ]; then 11 if ! dhall --explain resolve < "$(basename "$file")" >/dev/null; then
18 echo "Failed to resolve $file" 12 echo "Failed to resolve $file"
19 ERROR=1; 13 ERROR=1
20 fi; 14 fi;
21 popd; 15 cd - >/dev/null || exit
22 done; 16 done < <(find . -type f -name "*.dhall" -print0)
23 exit $ERROR; 17 exit $ERROR;
24} 18}
25 19