Skip to content

Commit

Permalink
Tweak language parsing to improve clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Oct 5, 2023
1 parent f243294 commit 8f0e8b0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 3 additions & 5 deletions lib/resolve-environment.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/resolve-environment.js.map

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

9 changes: 5 additions & 4 deletions src/resolve-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export async function runResolveBuildEnvironment(
const codeql = await getCodeQL(cmd);

let language = languageInput;
if (await util.codeQlVersionAbove(codeql, 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_VERSION_LANGUAGE_ALIASING))
) {
const parsedLanguage = parseLanguage(languageInput)?.toString();
if (parsedLanguage === undefined) {
throw new Error(`Did not recognize the language '${languageInput}'.`);
Expand Down

0 comments on commit 8f0e8b0

Please sign in to comment.