From a186477c8b2066240c774c46b43bef4342881a14 Mon Sep 17 00:00:00 2001 From: Gabo Date: Thu, 6 Aug 2020 19:49:23 -0500 Subject: [PATCH] Skip node_modules from finds --- lib/linter.sh | 8 ++++---- lib/worker.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 6c689b85..e3efa99c 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1261,7 +1261,7 @@ if [ "${VALIDATE_ARM}" == "true" ]; then ############################################################################### IFS=$'\n' - mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(json\)\$" 2>&1) + mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(json\)\$" 2>&1) for FILE in "${LIST_FILES[@]}"; do if DetectARMFile "${FILE}"; then FILE_ARRAY_ARM+=("${FILE}") @@ -1303,7 +1303,7 @@ if [ "${VALIDATE_CLOUDFORMATION}" == "true" ]; then ############################################################################### IFS=$'\n' - mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1) + mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1) for FILE in "${LIST_FILES[@]}"; do if DetectCloudFormationFile "${FILE}"; then FILE_ARRAY_CLOUDFORMATION+=("${FILE}") @@ -1557,7 +1557,7 @@ if [ "${VALIDATE_OPENAPI}" == "true" ]; then ############################################################################### IFS=$'\n' - mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1) + mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1) for FILE in "${LIST_FILES[@]}"; do if DetectOpenAPIFile "${FILE}"; then FILE_ARRAY_OPENAPI+=("${FILE}") @@ -1709,7 +1709,7 @@ if [ "${VALIDATE_STATES}" == "true" ]; then ############################################################################### IFS=$'\n' - mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(json\)\$" 2>&1) + mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(json\)\$" 2>&1) for FILE in "${LIST_FILES[@]}"; do if DetectAWSStatesFIle "${FILE}"; then FILE_ARRAY_STATES+=("${FILE}") diff --git a/lib/worker.sh b/lib/worker.sh index 434fe2f0..f560722f 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -85,7 +85,7 @@ function LintCodebase() { ################################# # Get list of all files to lint # ################################# - mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex "${FILE_EXTENSIONS}" 2>&1) + mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex "${FILE_EXTENSIONS}" 2>&1) ########################### # Set IFS back to default # @@ -312,7 +312,7 @@ function TestCodebase() { ################################# # 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/*" | sort 2>&1) + mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}/${INDVIDUAL_TEST_FOLDER}" -path "*/node_modules" -prune -o -type f -regex "${FILE_EXTENSIONS}" ! -path "${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}/ansible/ghe-initialize/*" | sort 2>&1) ######################################## # Prepare context if TAP output format #