mirror of
https://github.com/github/codeql-action
synced 2026-05-29 05:00:55 +03:00
Small refactoring of shouldBypassToolcache
This commit is contained in:
Generated
+1
-1
@@ -479,7 +479,7 @@ async function getRawLanguages(languagesInput, repository, logger) {
|
||||
}
|
||||
else {
|
||||
autodetected = true;
|
||||
// Obtain languages as all languages in the repo that can be analysed
|
||||
// Obtain all languages in the repo that can be analysed
|
||||
rawLanguages = (await getLanguagesInRepo(repository, logger));
|
||||
}
|
||||
return { rawLanguages, autodetected };
|
||||
|
||||
File diff suppressed because one or more lines are too long
Generated
+16
-16
@@ -728,23 +728,23 @@ async function shouldBypassToolcache(featuresEnablement, codeqlUrl, languagesInp
|
||||
if (await featuresEnablement.getValue(feature_flags_1.Feature.BypassToolcacheEnabled)) {
|
||||
return true;
|
||||
}
|
||||
let bypass = false;
|
||||
// Check if the toolcache is disabled for kotlin and swift.
|
||||
if (await featuresEnablement.getValue(feature_flags_1.Feature.BypassToolcacheKotlinSwiftEnabled)) {
|
||||
// Now check to see if kotlin or swift is one of the languages being analyzed.
|
||||
const { rawLanguages, autodetected } = await (0, config_utils_1.getRawLanguages)(languagesInput, repository, logger);
|
||||
bypass = rawLanguages.some((lang) => languages_1.KOTLIN_SWIFT_BYPASS.includes(lang));
|
||||
if (bypass) {
|
||||
logger.info(`Bypassing toolcache for kotlin or swift. Languages: ${rawLanguages}`);
|
||||
}
|
||||
else if (!autodetected && rawLanguages.includes(languages_1.Language.java)) {
|
||||
// special case: java was explicitly specified, but there might be
|
||||
// some kotlin in the repository, so we need to make a request for that.
|
||||
const langsInRepo = await (0, config_utils_1.getLanguagesInRepo)(repository, logger);
|
||||
if (langsInRepo.includes("kotlin")) {
|
||||
logger.info(`Bypassing toolcache for kotlin.`);
|
||||
bypass = true;
|
||||
}
|
||||
if (!(await featuresEnablement.getValue(feature_flags_1.Feature.BypassToolcacheKotlinSwiftEnabled))) {
|
||||
return false;
|
||||
}
|
||||
// Now check to see if kotlin or swift is one of the languages being analyzed.
|
||||
const { rawLanguages, autodetected } = await (0, config_utils_1.getRawLanguages)(languagesInput, repository, logger);
|
||||
let bypass = rawLanguages.some((lang) => languages_1.KOTLIN_SWIFT_BYPASS.includes(lang));
|
||||
if (bypass) {
|
||||
logger.info(`Bypassing toolcache for kotlin or swift. Languages: ${rawLanguages}`);
|
||||
}
|
||||
else if (!autodetected && rawLanguages.includes(languages_1.Language.java)) {
|
||||
// special case: java was explicitly specified, but there might be
|
||||
// some kotlin in the repository, so we need to make a request for that.
|
||||
const langsInRepo = await (0, config_utils_1.getLanguagesInRepo)(repository, logger);
|
||||
if (langsInRepo.includes("kotlin")) {
|
||||
logger.info(`Bypassing toolcache for kotlin.`);
|
||||
bypass = true;
|
||||
}
|
||||
}
|
||||
return bypass;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -973,7 +973,7 @@ export async function getRawLanguages(
|
||||
} else {
|
||||
autodetected = true;
|
||||
|
||||
// Obtain languages as all languages in the repo that can be analysed
|
||||
// Obtain all languages in the repo that can be analysed
|
||||
rawLanguages = (await getLanguagesInRepo(repository, logger)) as string[];
|
||||
}
|
||||
return { rawLanguages, autodetected };
|
||||
|
||||
+23
-20
@@ -861,30 +861,33 @@ export async function shouldBypassToolcache(
|
||||
return true;
|
||||
}
|
||||
|
||||
let bypass = false;
|
||||
// Check if the toolcache is disabled for kotlin and swift.
|
||||
if (
|
||||
await featuresEnablement.getValue(Feature.BypassToolcacheKotlinSwiftEnabled)
|
||||
!(await featuresEnablement.getValue(
|
||||
Feature.BypassToolcacheKotlinSwiftEnabled
|
||||
))
|
||||
) {
|
||||
// Now check to see if kotlin or swift is one of the languages being analyzed.
|
||||
const { rawLanguages, autodetected } = await getRawLanguages(
|
||||
languagesInput,
|
||||
repository,
|
||||
logger
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now check to see if kotlin or swift is one of the languages being analyzed.
|
||||
const { rawLanguages, autodetected } = await getRawLanguages(
|
||||
languagesInput,
|
||||
repository,
|
||||
logger
|
||||
);
|
||||
let bypass = rawLanguages.some((lang) => KOTLIN_SWIFT_BYPASS.includes(lang));
|
||||
if (bypass) {
|
||||
logger.info(
|
||||
`Bypassing toolcache for kotlin or swift. Languages: ${rawLanguages}`
|
||||
);
|
||||
bypass = rawLanguages.some((lang) => KOTLIN_SWIFT_BYPASS.includes(lang));
|
||||
if (bypass) {
|
||||
logger.info(
|
||||
`Bypassing toolcache for kotlin or swift. Languages: ${rawLanguages}`
|
||||
);
|
||||
} else if (!autodetected && rawLanguages.includes(Language.java)) {
|
||||
// special case: java was explicitly specified, but there might be
|
||||
// some kotlin in the repository, so we need to make a request for that.
|
||||
const langsInRepo = await getLanguagesInRepo(repository, logger);
|
||||
if (langsInRepo.includes("kotlin")) {
|
||||
logger.info(`Bypassing toolcache for kotlin.`);
|
||||
bypass = true;
|
||||
}
|
||||
} else if (!autodetected && rawLanguages.includes(Language.java)) {
|
||||
// special case: java was explicitly specified, but there might be
|
||||
// some kotlin in the repository, so we need to make a request for that.
|
||||
const langsInRepo = await getLanguagesInRepo(repository, logger);
|
||||
if (langsInRepo.includes("kotlin")) {
|
||||
logger.info(`Bypassing toolcache for kotlin.`);
|
||||
bypass = true;
|
||||
}
|
||||
}
|
||||
return bypass;
|
||||
|
||||
Reference in New Issue
Block a user