Skip to content

Commit 6158d72

Browse files
committed
Improve performance by only searching relevant paths
1 parent 087bde0 commit 6158d72

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

scripts/findPathsToScan.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ if [ -d "./${SOURCE_DIRECTORY}" ] ; then
4949
fi
5050

5151
# Scan Typescript analysis json data files in the source directory
52-
typescriptAnalysisFiles="$(find "./${SOURCE_DIRECTORY}" -type f -path "*/.reports/jqa/ts-output.json" -exec echo typescript:project::{} \; | tr '\n' ',' | sed 's/,$/\n/')"
52+
typescriptAnalysisFiles="$(find "./${SOURCE_DIRECTORY}" \
53+
-type d -name "node_modules" -prune -o \
54+
-type d -name "target" -prune -o \
55+
-type d -name "temp" -prune -o \
56+
-type f -path "*/.reports/jqa/ts-output.json" \
57+
-exec echo typescript:project::{} \; | tr '\n' ',' | sed 's/,$/\n/')"
58+
5359
if [ -n "${typescriptAnalysisFiles}" ]; then
5460
directoriesAndFilesToScan="$(appendNonEmpty "${directoriesAndFilesToScan}")${typescriptAnalysisFiles}"
5561
fi
@@ -64,7 +70,11 @@ if [ -d "./${SOURCE_DIRECTORY}" ] ; then
6470

6571
# Scan git repositories in the artifacts directory
6672
if [ "${IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT}" = "" ] || [ "${IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT}" = "plugin" ] ; then
67-
gitDirectories="$(find "./${SOURCE_DIRECTORY}" -type d -name ".git" -exec echo {} \; | tr '\n' ',' | sed 's/,$/\n/')"
73+
gitDirectories="$(find "./${SOURCE_DIRECTORY}" \
74+
-type d -name "node_modules" -prune -o \
75+
-type d -name "target" -prune -o \
76+
-type d -name "temp" -prune -o \
77+
-type d -name ".git" -exec echo {} \; | tr '\n' ',' | sed 's/,$/\n/')"
6878
if [ -n "${gitDirectories}" ]; then
6979
directoriesAndFilesToScan="$(appendNonEmpty "${directoriesAndFilesToScan}")${gitDirectories}"
7080
fi

0 commit comments

Comments
 (0)