Add API call for languages if java in input

If a user explicitly includes java in their language inputs, always
make an api call to check for kotlin in the repo.

Also, add some suggestions from code reviews.
This commit is contained in:
Andrew Eisenberg 2022-11-24 11:06:29 -08:00
parent ad7ca9bf21
commit eb19ecbad1
12 changed files with 112 additions and 92 deletions

View file

@ -860,7 +860,7 @@ export function getUnknownLanguagesError(languages: string[]): string {
* Gets the set of languages in the current repository that are
* scannable by CodeQL.
*/
async function getLanguagesInRepo(
export async function getLanguagesInRepo(
repository: RepositoryNwo,
logger: Logger
): Promise<LanguageOrAlias[]> {
@ -937,6 +937,9 @@ export async function getLanguages(
parsedLanguages.push(parsedLanguage);
}
}
// Any unknown languages here would have come directly from the input
// since we filter unknown languages coming from the GitHub API.
if (unknownLanguages.length > 0) {
throw new Error(getUnknownLanguagesError(unknownLanguages));
}