Merge pull request #1234 from github/edoardo/more-tolerant
TRAP Caching: Be tolerant to not finding the extractor
This commit is contained in:
commit
8cdb7d8545
3 changed files with 24 additions and 5 deletions
11
lib/trap-caching.js
generated
11
lib/trap-caching.js
generated
|
|
@ -141,9 +141,16 @@ async function getLanguagesSupportingCaching(codeql, languages, logger) {
|
||||||
return result;
|
return result;
|
||||||
const resolveResult = await codeql.betterResolveLanguages();
|
const resolveResult = await codeql.betterResolveLanguages();
|
||||||
outer: for (const lang of languages) {
|
outer: for (const lang of languages) {
|
||||||
if (resolveResult.extractors[lang].length !== 1)
|
const extractorsForLanguage = resolveResult.extractors[lang];
|
||||||
|
if (extractorsForLanguage === undefined) {
|
||||||
|
logger.info(`${lang} does not support TRAP caching (couldn't find an extractor)`);
|
||||||
continue;
|
continue;
|
||||||
const extractor = resolveResult.extractors[lang][0];
|
}
|
||||||
|
if (extractorsForLanguage.length !== 1) {
|
||||||
|
logger.info(`${lang} does not support TRAP caching (found multiple extractors)`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const extractor = extractorsForLanguage[0];
|
||||||
const trapCacheOptions = (_d = (_c = (_b = (_a = extractor.extractor_options) === null || _a === void 0 ? void 0 : _a.trap) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.properties;
|
const trapCacheOptions = (_d = (_c = (_b = (_a = extractor.extractor_options) === null || _a === void 0 ? void 0 : _a.trap) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.properties;
|
||||||
if (trapCacheOptions === undefined) {
|
if (trapCacheOptions === undefined) {
|
||||||
logger.info(`${lang} does not support TRAP caching (missing option group)`);
|
logger.info(`${lang} does not support TRAP caching (missing option group)`);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -162,8 +162,20 @@ export async function getLanguagesSupportingCaching(
|
||||||
return result;
|
return result;
|
||||||
const resolveResult = await codeql.betterResolveLanguages();
|
const resolveResult = await codeql.betterResolveLanguages();
|
||||||
outer: for (const lang of languages) {
|
outer: for (const lang of languages) {
|
||||||
if (resolveResult.extractors[lang].length !== 1) continue;
|
const extractorsForLanguage = resolveResult.extractors[lang];
|
||||||
const extractor = resolveResult.extractors[lang][0];
|
if (extractorsForLanguage === undefined) {
|
||||||
|
logger.info(
|
||||||
|
`${lang} does not support TRAP caching (couldn't find an extractor)`
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (extractorsForLanguage.length !== 1) {
|
||||||
|
logger.info(
|
||||||
|
`${lang} does not support TRAP caching (found multiple extractors)`
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const extractor = extractorsForLanguage[0];
|
||||||
const trapCacheOptions =
|
const trapCacheOptions =
|
||||||
extractor.extractor_options?.trap?.properties?.cache?.properties;
|
extractor.extractor_options?.trap?.properties?.cache?.properties;
|
||||||
if (trapCacheOptions === undefined) {
|
if (trapCacheOptions === undefined) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue