Merge pull request #291 from github/SpaceSupport

Adding space support
This commit is contained in:
Lukas Gravley 2020-06-26 10:51:42 -05:00 committed by GitHub
commit 62717c09c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,6 +132,7 @@ RAW_FILE_ARRAY=() # Array of all files that were changed
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
DEFAULT_IFS="$IFS" # Get the Default IFS for updating
########################## ##########################
# Array of changed files # # Array of changed files #
@ -1856,12 +1857,22 @@ LintCodebase()
# We have files added to array of files to check # We have files added to array of files to check
LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list
else else
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
################################# #################################
# Get list of all files to lint # # Get list of all files to lint #
################################# #################################
# shellcheck disable=SC2207,SC2086 # shellcheck disable=SC2207,SC2086
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex "$FILE_EXTENSIONS" 2>&1)) LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex "$FILE_EXTENSIONS" 2>&1))
###########################
# Set IFS back to default #
###########################
IFS="$DEFAULT_IFS"
############################################################ ############################################################
# Set it back to empty if loaded with blanks from scanning # # Set it back to empty if loaded with blanks from scanning #
############################################################ ############################################################
@ -2028,11 +2039,21 @@ TestCodebase()
# shellcheck disable=SC2207,SC2086,SC2010 # shellcheck disable=SC2207,SC2086,SC2010
LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; ls ansible/ | grep ".yml" 2>&1)) LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; ls ansible/ | grep ".yml" 2>&1))
else else
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
################################# #################################
# Get list of all files to lint # # Get list of all files to lint #
################################# #################################
# shellcheck disable=SC2207,SC2086 # shellcheck disable=SC2207,SC2086
LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1)) LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1))
###########################
# Set IFS back to default #
###########################
IFS="$DEFAULT_IFS"
fi fi
################## ##################
@ -2660,6 +2681,11 @@ fi
if [ "$VALIDATE_OPENAPI" == "true" ]; then if [ "$VALIDATE_OPENAPI" == "true" ]; then
# If we are validating all codebase we need to build file list because not every yml/json file is an OpenAPI file # If we are validating all codebase we need to build file list because not every yml/json file is an OpenAPI file
if [ "$VALIDATE_ALL_CODEBASE" == "true" ]; then if [ "$VALIDATE_ALL_CODEBASE" == "true" ]; then
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
# shellcheck disable=SC2207 # shellcheck disable=SC2207
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)) LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1))
for FILE in "${LIST_FILES[@]}" for FILE in "${LIST_FILES[@]}"
@ -2668,6 +2694,11 @@ if [ "$VALIDATE_OPENAPI" == "true" ]; then
FILE_ARRAY_OPENAPI+=("$FILE") FILE_ARRAY_OPENAPI+=("$FILE")
fi fi
done done
###########################
# Set IFS back to default #
###########################
IFS="$DEFAULT_IFS"
fi fi
########################## ##########################