diff --git a/hooks/_common.sh b/hooks/_common.sh index 7281b0244..c63918033 100644 --- a/hooks/_common.sh +++ b/hooks/_common.sh @@ -176,9 +176,9 @@ function common::is_hook_run_on_whole_repo { local all_files_that_can_be_checked if [ -z "$excluded_files" ]; then - all_files_that_can_be_checked=$(git ls-files | sort | grep -e "$included_files" | tr '\n' ' ') + all_files_that_can_be_checked=$(git ls-files | sort | grep -E -- "$included_files" | tr '\n' ' ') else - all_files_that_can_be_checked=$(git ls-files | sort | grep -e "$included_files" | grep -v -e "$excluded_files" | tr '\n' ' ') + all_files_that_can_be_checked=$(git ls-files | sort | grep -E -- "$included_files" | grep -v -E -- "$excluded_files" | tr '\n' ' ') fi if [ "$files_to_check" == "$all_files_that_can_be_checked" ]; then diff --git a/hooks/terraform_docs.sh b/hooks/terraform_docs.sh index 02d012f83..7644b5e4c 100755 --- a/hooks/terraform_docs.sh +++ b/hooks/terraform_docs.sh @@ -187,7 +187,7 @@ function terraform_docs { config_file_no_color="$config_file$(date +%s).yml" if [ "$PRE_COMMIT_COLOR" = "never" ] && - [[ $(grep -e '^formatter:' "$config_file") == *"pretty"* ]] && + [[ $(grep -E '^formatter:' "$config_file") == *"pretty"* ]] && [[ $(grep ' color: ' "$config_file") != *"false"* ]]; then cp "$config_file" "$config_file_no_color" diff --git a/hooks/terraform_trivy.sh b/hooks/terraform_trivy.sh index fb4a529a0..d607d67a5 100755 --- a/hooks/terraform_trivy.sh +++ b/hooks/terraform_trivy.sh @@ -65,7 +65,7 @@ function run_hook_on_whole_repo { local -a -r args=("$@") # pass the arguments to hook - trivy conf "$(pwd)" "${args[@]}" + trivy conf "$(pwd)" --exit-code=1 "${args[@]}" # return exit code to common::per_dir_hook local exit_code=$?