From 3abe0fc5e6792090edaf4ed897fea75217111cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B6rn=20=27Puggan=27=20Sundragon?= Date: Wed, 3 Feb 2021 16:52:12 +0100 Subject: [PATCH] Move FILTER_REGEX_INCLUDE and FILTER_REGEX_EXCLUDE test (#1022) * Move FILTER_REGEX_INCLUDE AND FILTER_REGEX_EXCLUDE before checking filetype * missing continue, and a lint error Co-authored-by: Marco Ferrari --- lib/functions/buildFileList.sh | 16 ++++++++++++++++ lib/functions/worker.sh | 20 -------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/lib/functions/buildFileList.sh b/lib/functions/buildFileList.sh index 5c5d2c30..3d2d3335 100755 --- a/lib/functions/buildFileList.sh +++ b/lib/functions/buildFileList.sh @@ -221,6 +221,22 @@ function BuildFileList() { debug "TEST_CASE_RUN (${TEST_CASE_RUN}) is true. Skipping ${FILE}..." fi + ################################################# + # Filter files if FILTER_REGEX_INCLUDE is set # + ################################################# + if [[ -n "$FILTER_REGEX_INCLUDE" ]] && [[ ! (${FILE} =~ $FILTER_REGEX_INCLUDE) ]]; then + debug "FILTER_REGEX_INCLUDE didn't match. Skipping ${FILE}" + continue + fi + + ################################################# + # Filter files if FILTER_REGEX_EXCLUDE is set # + ################################################# + if [[ -n "$FILTER_REGEX_EXCLUDE" ]] && [[ ${FILE} =~ $FILTER_REGEX_EXCLUDE ]]; then + debug "FILTER_REGEX_EXCLUDE match. Skipping ${FILE}" + continue + fi + # Editorconfig-checker should check every file FILE_ARRAY_EDITORCONFIG+=("${FILE}") # jscpd also runs an all files diff --git a/lib/functions/worker.sh b/lib/functions/worker.sh index f1a1d95a..b460b0bd 100755 --- a/lib/functions/worker.sh +++ b/lib/functions/worker.sh @@ -47,26 +47,6 @@ function LintCodebase() { debug "SKIP_FLAG: ${SKIP_FLAG}, list of files to lint: ${LIST_FILES[*]}" - ################################################# - # Filter files if FILTER_REGEX_INCLUDE is set # - ################################################# - if [[ -n "$FILTER_REGEX_INCLUDE" ]]; then - for index in "${!LIST_FILES[@]}"; do - [[ ! (${LIST_FILES[$index]} =~ $FILTER_REGEX_INCLUDE) ]] && unset -v 'LIST_FILES[$index]' - done - debug "List of files to lint after FILTER_REGEX_INCLUDE: ${LIST_FILES[*]}" - fi - - ################################################# - # Filter files if FILTER_REGEX_EXCLUDE is set # - ################################################# - if [[ -n "$FILTER_REGEX_EXCLUDE" ]]; then - for index in "${!LIST_FILES[@]}"; do - [[ ${LIST_FILES[$index]} =~ $FILTER_REGEX_EXCLUDE ]] && unset -v 'LIST_FILES[$index]' - done - debug "List of files to lint after FILTER_REGEX_EXCLUDE: ${LIST_FILES[*]}" - fi - ############################### # Check if any data was found # ###############################