From 086b2ad38f63704139461b3eb81ca73224bdaa3b Mon Sep 17 00:00:00 2001 From: Nick Henry Date: Thu, 30 Jun 2022 10:24:28 -0600 Subject: [PATCH] refactor: Reuse logic from common functions From @MaxymVlasov in https://github.com/antonbabenko/pre-commit-terraform/pull/401#discussion_r903065694: > Heh, you found code written in Paleolithic. > > Let's try reuse logic that used in common functions here: > > https://github.com/antonbabenko/pre-commit-terraform/blob/master/hooks/_common.sh#L178 > > Absolutely have no idea why it was written in so complex way --- hooks/terraform_validate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/terraform_validate.sh b/hooks/terraform_validate.sh index 2f77b16c7..322af1b12 100755 --- a/hooks/terraform_validate.sh +++ b/hooks/terraform_validate.sh @@ -111,7 +111,7 @@ function terraform_validate_ { if [[ -n "$(find "$dir_path" -maxdepth 1 -name '*.tf' -print -quit)" ]]; then - pushd "$(cd "$dir_path" > /dev/null && pwd -P)" > /dev/null + pushd "$dir_path" > /dev/null || continue if [ ! -d .terraform ]; then set +e