filter ** paths
This commit is contained in:
parent
abf6f239fa
commit
56417be251
6 changed files with 25 additions and 14 deletions
9
lib/analysis-paths.js
generated
9
lib/analysis-paths.js
generated
|
|
@ -11,6 +11,10 @@ const core = __importStar(require("@actions/core"));
|
|||
function isInterpretedLanguage(language) {
|
||||
return language === 'javascript' || language === 'python';
|
||||
}
|
||||
// Builds an environment variable suitable for LGTM_INDEX_INCLUDE or LGTM_INDEX_EXCLUDE
|
||||
function buildIncludeExcludeEnvVar(paths) {
|
||||
return paths.filter(p => p.indexOf('**') === -1).join('\n');
|
||||
}
|
||||
function includeAndExcludeAnalysisPaths(config, languages) {
|
||||
// The 'LGTM_INDEX_INCLUDE' and 'LGTM_INDEX_EXCLUDE' environment variables
|
||||
// control which files/directories are traversed when scanning.
|
||||
|
|
@ -18,11 +22,12 @@ function includeAndExcludeAnalysisPaths(config, languages) {
|
|||
// excluding and not traversing entire file subtrees.
|
||||
// It does not understand double-globs because that would require it to
|
||||
// traverse the entire file tree to determine which files are matched.
|
||||
// Any paths containing "**" are not included in these.
|
||||
if (config.paths.length !== 0) {
|
||||
core.exportVariable('LGTM_INDEX_INCLUDE', config.paths.join('\n'));
|
||||
core.exportVariable('LGTM_INDEX_INCLUDE', buildIncludeExcludeEnvVar(config.paths));
|
||||
}
|
||||
if (config.pathsIgnore.length !== 0) {
|
||||
core.exportVariable('LGTM_INDEX_EXCLUDE', config.pathsIgnore.join('\n'));
|
||||
core.exportVariable('LGTM_INDEX_EXCLUDE', buildIncludeExcludeEnvVar(config.pathsIgnore));
|
||||
}
|
||||
// The 'LGTM_INDEX_FILTERS' environment variable controls which files are
|
||||
// extracted or ignored. It does not control which directories are traversed.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue