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 <ferrari.marco@gmail.com>
This commit is contained in:
Thorbjörn 'Puggan' Sundragon 2021-02-03 16:52:12 +01:00 committed by GitHub
parent e77c41432c
commit 3abe0fc5e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 20 deletions

View file

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

View file

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