File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -73,11 +73,25 @@ if [ -z "${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT:-}" ]; then
7373 export CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR=" $CODEQL_EXTRACTOR_CDS_SOURCE_ARCHIVE_DIR "
7474fi
7575
76+ # Check if LGTM_INDEX_FILTERS is already set
77+ # This typically happens if "paths" or "paths-ignore" are set in the LGTM.yml file
78+ if [ -z " ${LGTM_INDEX_FILTERS:- } " ]; then
79+ # If it is set, we will try to honour the paths-ignore filter
80+ # Split by \n and find all the entries that start with exclude, excluding "exclude:**/*" and "exclude:**/*.*"
81+ # and then join them back together with \n
82+ exclude_filters=" \n$( grep ' ^exclude' " $LGTM_INDEX_FILTERS " | grep -v ' exclude:**/\*\|exclude:**/\*\.\*' ) "
83+ else
84+ exclude_filters=" "
85+ fi
86+
7687# Enable extraction of the cds.json files only
77- export LGTM_INDEX_FILTERS=$' exclude:**/*.*\n include:**/*.cds.json\n include:**/*.cds\n exclude:**/node_modules/**/*.*'
88+ export LGTM_INDEX_FILTERS=$' exclude:**/*.*\n include:**/*.cds.json\n include:**/*.cds\n exclude:**/node_modules/**/*.*' " $exclude_filters "
7889export LGTM_INDEX_TYPESCRIPT=" NONE"
7990# Configure to copy over the CDS files as well, by pretending they are JSON
8091export LGTM_INDEX_FILETYPES=" .cds:JSON"
92+ # Ignore the LGTM_INDEX_INCLUDE variable for this purpose, as it may
93+ # refer explicitly to .ts or .js files
94+ unset LGTM_INDEX_INCLUDE
8195
8296echo " Extracting the cds.json files"
8397
You can’t perform that action at this time.
0 commit comments