From 0c667db03cfac215c9a6d2a4d2398340daf40ccf Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Wed, 20 Sep 2023 10:10:50 -0600 Subject: [PATCH] Make shellcheck happier --- would-reformat.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/would-reformat.sh b/would-reformat.sh index e647857..9f9f307 100755 --- a/would-reformat.sh +++ b/would-reformat.sh @@ -15,11 +15,11 @@ file="$1" -file_type=$(sniff_file_type $file) +file_type=$(sniff_file_type "$file") -wrflog got file_type $file_type +wrflog got file_type "$file_type" -WOULD_REFORMAT=would_reformat +export WOULD_REFORMAT=would_reformat if [[ $file_type = "javascript" || \ $file_type = "vue" || \ @@ -32,16 +32,16 @@ if [[ $file_type = "javascript" || \ $file_type == "css" || \ $file_type == "scss" || \ $file_type = "sh" ]]; then -wrflog will run thing -wrflog "$(wfroot $DIR)" -wrflog "prettier: $(ls -l $(wfroot $DIR)/./prettier.sh)" - out=$($(wfroot $DIR)/./prettier.sh $file 2>&1 > /dev/null) + wrflog will run thing + wrflog "$(wfroot "$DIR")" + wrflog "prettier: $(ls -l "$(wfroot "$DIR")"/./prettier.sh)" + out=$("$(wfroot "$DIR")"/./prettier.sh "$file" 2>&1 > /dev/null) retval="$?" success_retval=0 would_reformat_retval=1 syntax_error_retval=2 elif [[ $file_type == "python" ]]; then - out=$($(wfroot $DIR)/./isort-and-black.sh $file 2>&1 > /dev/null) + out=$("$(wfroot "$DIR")"/./isort-and-black.sh "$file" 2>&1 > /dev/null) retval="$?" success_retval=0 would_reformat_retval=1 @@ -51,12 +51,12 @@ elif [[ $file_type == "golang" ]] ; then would_reformat_retval=1 syntax_error_retval=2 - out=$(gofmt -l $file) + out=$(gofmt -l "$file") exitval="$?" - if [[ x"$exitval" = x"$syntax_error_retval" ]] ; then + if [[ "$exitval" = "$syntax_error_retval" ]] ; then retval="$exitval" - elif [[ x"$out" = x"$file" ]] ; then + elif [[ "$out" = "$file" ]] ; then retval="$would_reformat_retval" else # success