Tweak language parsing to improve clarity

This commit is contained in:
Henry Mercer 2023-10-05 16:26:47 +01:00
parent f243294ab7
commit 8f0e8b0890
3 changed files with 9 additions and 10 deletions

View file

@ -31,11 +31,9 @@ async function runResolveBuildEnvironment(cmd, logger, workingDir, languageInput
logger.startGroup(`Attempting to resolve build environment for ${languageInput}`);
const codeql = await (0, codeql_1.getCodeQL)(cmd);
let language = languageInput;
if (await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING)) {
// Delegate to the CodeQL CLI to handle aliasing.
}
else {
// Handle aliasing in the Action using `parseLanguage`.
// If the CodeQL CLI version in use supports language aliasing, give the CLI the raw language
// input. Otherwise, parse the language input and give the CLI the parsed language.
if (!(await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING))) {
const parsedLanguage = (0, languages_1.parseLanguage)(languageInput)?.toString();
if (parsedLanguage === undefined) {
throw new Error(`Did not recognize the language '${languageInput}'.`);