Remove redundant checks
This commit is contained in:
parent
a41df3ae10
commit
dc0234b48c
3 changed files with 13 additions and 32 deletions
17
lib/setup-codeql.js
generated
17
lib/setup-codeql.js
generated
|
|
@ -329,19 +329,13 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||
}
|
||||
// Fall back to matching `0.0.0-<bundleVersion>`.
|
||||
if (!codeqlFolder && tagName) {
|
||||
if (tagName) {
|
||||
const fallbackVersion = await tryGetFallbackToolcacheVersion(cliVersion, tagName, logger);
|
||||
if (fallbackVersion) {
|
||||
codeqlFolder = toolcache.find("CodeQL", fallbackVersion);
|
||||
}
|
||||
else {
|
||||
logger.debug("Could not determine a fallback toolcache version number for CodeQL tools version " +
|
||||
`${humanReadableVersion}.`);
|
||||
}
|
||||
const fallbackVersion = await tryGetFallbackToolcacheVersion(cliVersion, tagName, logger);
|
||||
if (fallbackVersion) {
|
||||
codeqlFolder = toolcache.find("CodeQL", fallbackVersion);
|
||||
}
|
||||
else {
|
||||
logger.debug("Could not determine a fallback toolcache version number for CodeQL tools version " +
|
||||
`${humanReadableVersion} since the tag name is unknown.`);
|
||||
`${humanReadableVersion}.`);
|
||||
}
|
||||
}
|
||||
if (codeqlFolder) {
|
||||
|
|
@ -385,9 +379,6 @@ exports.getCodeQLSource = getCodeQLSource;
|
|||
* the `x.y.z` version. This is to support old versions of the toolcache.
|
||||
*/
|
||||
async function tryGetFallbackToolcacheVersion(cliVersion, tagName, logger) {
|
||||
if (!tagName) {
|
||||
return undefined;
|
||||
}
|
||||
const bundleVersion = tryGetBundleVersionFromTagName(tagName, logger);
|
||||
if (!bundleVersion) {
|
||||
return undefined;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -422,24 +422,17 @@ export async function getCodeQLSource(
|
|||
|
||||
// Fall back to matching `0.0.0-<bundleVersion>`.
|
||||
if (!codeqlFolder && tagName) {
|
||||
if (tagName) {
|
||||
const fallbackVersion = await tryGetFallbackToolcacheVersion(
|
||||
cliVersion,
|
||||
tagName,
|
||||
logger
|
||||
);
|
||||
if (fallbackVersion) {
|
||||
codeqlFolder = toolcache.find("CodeQL", fallbackVersion);
|
||||
} else {
|
||||
logger.debug(
|
||||
"Could not determine a fallback toolcache version number for CodeQL tools version " +
|
||||
`${humanReadableVersion}.`
|
||||
);
|
||||
}
|
||||
const fallbackVersion = await tryGetFallbackToolcacheVersion(
|
||||
cliVersion,
|
||||
tagName,
|
||||
logger
|
||||
);
|
||||
if (fallbackVersion) {
|
||||
codeqlFolder = toolcache.find("CodeQL", fallbackVersion);
|
||||
} else {
|
||||
logger.debug(
|
||||
"Could not determine a fallback toolcache version number for CodeQL tools version " +
|
||||
`${humanReadableVersion} since the tag name is unknown.`
|
||||
`${humanReadableVersion}.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -506,9 +499,6 @@ export async function tryGetFallbackToolcacheVersion(
|
|||
tagName: string,
|
||||
logger: Logger
|
||||
): Promise<string | undefined> {
|
||||
if (!tagName) {
|
||||
return undefined;
|
||||
}
|
||||
const bundleVersion = tryGetBundleVersionFromTagName(tagName, logger);
|
||||
if (!bundleVersion) {
|
||||
return undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue