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 # ###############################