mirror of
https://github.com/github/codeql-action.git
synced 2026-10-30 09:37:15 +00:00
Use nullish conversion for packs
Slightly simplifies the `parsePacks` function.
This commit is contained in:
@@ -999,7 +999,11 @@ async function loadConfig(
|
||||
}
|
||||
}
|
||||
|
||||
const packs = parsePacks(parsedYAML[PACKS_PROPERTY], languages, configFile);
|
||||
const packs = parsePacks(
|
||||
parsedYAML[PACKS_PROPERTY] ?? {},
|
||||
languages,
|
||||
configFile
|
||||
);
|
||||
|
||||
return {
|
||||
languages,
|
||||
@@ -1029,16 +1033,12 @@ const PACK_IDENTIFIER_PATTERN = (function () {
|
||||
|
||||
// Exported for testing
|
||||
export function parsePacks(
|
||||
packsByLanguage: string[] | Record<string, string[]> | undefined,
|
||||
packsByLanguage: string[] | Record<string, string[]>,
|
||||
languages: Language[],
|
||||
configFile: string
|
||||
): Packs {
|
||||
const packs = {};
|
||||
|
||||
if (!packsByLanguage) {
|
||||
return packs;
|
||||
}
|
||||
|
||||
if (Array.isArray(packsByLanguage)) {
|
||||
if (languages.length === 1) {
|
||||
// single language analysis, so language is implicit
|
||||
|
||||
Reference in New Issue
Block a user