From 03e6c47086cd03967cad2a8fd8872bedd060564a Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 9 Apr 2022 15:42:36 +0200 Subject: [PATCH] pre-commit hook: fix shellcheck SCSC2181 Check exit code directly with e.g. if mycmd; not indirectly with $? https://github.com/koalaman/shellcheck/wiki/SC2181 --- shell/hooks/pre-commit.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 5d8ba2df..2a370734 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -20,8 +20,7 @@ if [[ -n "${nix_files[@]}" ]]; then fi # check editorconfig -editorconfig-checker -- "${all_files[@]}" -if [[ $? != '0' ]]; then +if ! editorconfig-checker -- "${all_files[@]}"; then printf "%b\n" \ "\nCode is not aligned with .editorconfig" \ "Review the output and commit your fixes" >&2