Remove unneeded version guards

This commit is contained in:
Henry Mercer
2024-10-15 19:38:49 +01:00
parent d77a73b68c
commit fc983c82c2
12 changed files with 25 additions and 186 deletions

View File

@@ -6,14 +6,13 @@ import * as yaml from "js-yaml";
import * as semver from "semver";
import * as api from "./api-client";
import { CodeQL, CODEQL_VERSION_LANGUAGE_ALIASING } from "./codeql";
import { CodeQL } from "./codeql";
import { Feature, FeatureEnablement } from "./feature-flags";
import { Language, parseLanguage } from "./languages";
import { Logger } from "./logging";
import { RepositoryNwo } from "./repository";
import { downloadTrapCaches } from "./trap-caching";
import {
codeQlVersionAtLeast,
GitHubVersion,
prettyPrintPack,
ConfigurationError,
@@ -317,7 +316,7 @@ export async function getLanguages(
logger.info(`Automatically detected languages: ${languages.join(", ")}`);
} else {
const aliases = await getLanguageAliases(codeQL);
const aliases = (await codeQL.betterResolveLanguages()).aliases;
if (aliases) {
languages = languages.map((lang) => aliases[lang] || lang);
}
@@ -352,19 +351,6 @@ export async function getLanguages(
return parsedLanguages;
}
/**
* Gets the set of languages supported by CodeQL, along with their aliases if supported by the
* version of the CLI.
*/
export async function getLanguageAliases(
codeql: CodeQL,
): Promise<{ [alias: string]: string } | undefined> {
if (await codeQlVersionAtLeast(codeql, CODEQL_VERSION_LANGUAGE_ALIASING)) {
return (await codeql.betterResolveLanguages()).aliases;
}
return undefined;
}
/**
* Gets the set of languages in the current repository without checking to
* see if these languages are actually supported by CodeQL.