From f5331bdcd31717f3775d2e6ca00766822a727447 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Mon, 31 Aug 2020 19:30:50 +0200 Subject: [PATCH] Skip shfmt if no .editorconfig file is present --- lib/linter.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index b724327e..93bcc695 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1852,8 +1852,17 @@ if [ "${VALIDATE_SHELL_SHFMT}" == "true" ]; then #################################### # Lint the files with shfmt # #################################### - # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "SHELL_SHFMT" "shfmt" "shfmt -d" ".*\.\(sh\|bash\|dash\|ksh\)\$" "${FILE_ARRAY_BASH[@]}" + EDITORCONFIG_FILE_PATH="${GITHUB_WORKSPACE}"/.editorconfig + if [ -e "$EDITORCONFIG_FILE_PATH" ]; then + # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" + LintCodebase "SHELL_SHFMT" "shfmt" "shfmt -d" ".*\.\(sh\|bash\|dash\|ksh\)\$" "${FILE_ARRAY_BASH[@]}" + else + ############################### + # No .editorconfig file found # + ############################### + warn "No .editorconfig found at:[$EDITORCONFIG_FILE_PATH]" + debug "skipping shfmt" + fi fi ######################