Skip to content

Commit

Permalink
TRAP Caching: Be tolerant to not finding the extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardopirovano committed Sep 5, 2022
1 parent 03e3453 commit 299b774
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
11 changes: 9 additions & 2 deletions lib/trap-caching.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/trap-caching.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/trap-caching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,20 @@ export async function getLanguagesSupportingCaching(
return result;
const resolveResult = await codeql.betterResolveLanguages();
outer: for (const lang of languages) {
if (resolveResult.extractors[lang].length !== 1) continue;
const extractor = resolveResult.extractors[lang][0];
const extractorsForLanguage = resolveResult.extractors[lang];
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 =
extractor.extractor_options?.trap?.properties?.cache?.properties;
if (trapCacheOptions === undefined) {
Expand Down

0 comments on commit 299b774

Please sign in to comment.