From c6594d8fb5cf6a35e412e2042174a6009c561509 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 30 Jun 2020 09:56:15 -0500 Subject: [PATCH] Fix new issues --- .vscode/testlinter.sh | 2 +- lib/buildFileList.sh | 2 +- lib/linter.sh | 11 ++++++++--- lib/worker.sh | 28 ++++------------------------ 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/.vscode/testlinter.sh b/.vscode/testlinter.sh index 69497bb5..50427028 100644 --- a/.vscode/testlinter.sh +++ b/.vscode/testlinter.sh @@ -22,5 +22,5 @@ fi ######################### export RUN_LOCAL=true -# shellcheck source=../lib/linter.sh +# shellcheck source=/dev/null source "$PWD"/lib/linter.sh diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 0f011b3b..c10284c8 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -411,7 +411,7 @@ function BuildFileList() fi done - echo $READ_ONLY_CHANGE_FLAG > /dev/null 2>&1 || true # Workaround SC2034 + echo ${READ_ONLY_CHANGE_FLAG} > /dev/null 2>&1 || true # Workaround SC2034 ######################################### # Need to switch back to branch of code # diff --git a/lib/linter.sh b/lib/linter.sh index 069a55e2..3a2696ca 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -9,11 +9,11 @@ ######################### # Source Function Files # ######################### -# shellcheck source=../lib/buildFileList.sh +# shellcheck source=/dev/null source /action/lib/buildFileList.sh # Source the function script(s) -# shellcheck source=../lib/validation.sh +# shellcheck source=/dev/null source /action/lib/validation.sh # Source the function script(s) -# shellcheck source=../lib/worker.sh +# shellcheck source=/dev/null source /action/lib/worker.sh # Source the function script(s) ########### @@ -150,10 +150,15 @@ DEFAULT_IFS="$IFS" # Get the Default IFS for updating # Default Vars that are called in Subs and need to be ignored # ############################################################### DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors +echo "${DEFAULT_DISABLE_ERRORS}" > /dev/null 2>&1 || true # Workaround SC2034 RAW_FILE_ARRAY=() # Array of all files that were changed +echo "${RAW_FILE_ARRAY[*]}" > /dev/null 2>&1 || true # Workaround SC2034 READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md +echo "${READ_ONLY_CHANGE_FLAG}" > /dev/null 2>&1 || true # Workaround SC2034 TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore +echo "${TEST_CASE_FOLDER}" > /dev/null 2>&1 || true # Workaround SC2034 DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory +echo "${DEFAULT_ANSIBLE_DIRECTORY}" > /dev/null 2>&1 || true # Workaround SC2034 ########################## # Array of changed files # diff --git a/lib/worker.sh b/lib/worker.sh index 70ffc4e9..10e8ca42 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -253,30 +253,10 @@ function TestCodebase() ########################## LIST_FILES=() - ############################################ - # Check if its ansible, as its the outlier # - ############################################ - if [[ "$FILE_TYPE" == "ANSIBLE" ]]; then - ################################# - # Get list of all files to lint # - ################################# - mapfile -t LIST_FILES < <(ls "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible/*.yml" 2>&1) - else - ############################################################################### - # Set the file seperator to newline to allow for grabbing objects with spaces # - ############################################################################### - IFS=$'\n' - - ################################# - # Get list of all files to lint # - ################################# - mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1) - - ########################### - # Set IFS back to default # - ########################### - IFS="$DEFAULT_IFS" - fi + ################################# + # Get list of all files to lint # + ################################# + mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" -type f -regex "$FILE_EXTENSIONS" ! -path "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible/ghe-initialize/*" 2>&1) ################## # Lint the files #