Skip to content

Commit 06898d7

Browse files
committed
Rename mergeUserConfigs
1 parent 7ccd988 commit 06898d7

4 files changed

Lines changed: 23 additions & 14 deletions

File tree

lib/entry-points.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config-utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
calculateAugmentation,
2828
ExcludeQueryFilter,
2929
generateCodeScanningConfig,
30-
mergeUserConfigs,
30+
mergeDefaultSetupAndUserConfigs,
3131
parseUserConfig,
3232
UserConfig,
3333
} from "./config/db-config";
@@ -1036,7 +1036,8 @@ export async function determineUserConfig(
10361036
// 1. A `config` or `config-file` input is provided, but not both: use the provided one.
10371037
// 2. Both are provided and we are in an advanced workflow: ignore the `config-file` input.
10381038
// 3. Both are provided and we are in Default Setup: the `config` input uses a limited
1039-
// set of options, which are supported by `mergeUserConfigs`, and we merge the two configs.
1039+
// set of options, which are supported by `mergeDefaultSetupAndUserConfigs`,
1040+
// and we merge the two configs.
10401041
if (inputs.configInput) {
10411042
const computedConfigPath = userConfigFromActionPath(tempDir);
10421043

@@ -1070,7 +1071,7 @@ export async function determineUserConfig(
10701071

10711072
// Write the merged configuration to disk so that it can be loaded subsequently by
10721073
// the CLI or other CodeQL Action steps.
1073-
const mergedConfig = mergeUserConfigs(
1074+
const mergedConfig = mergeDefaultSetupAndUserConfigs(
10741075
action.logger,
10751076
fromConfigInput,
10761077
fromConfigFile,

src/config/db-config.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,9 @@ test("parseUserConfig - throws no ConfigurationError if validation should fail,
490490
);
491491
});
492492

493-
test("mergeUserConfigs - combines threat models", async (t) => {
493+
test("mergeDefaultSetupAndUserConfigs - combines threat models", async (t) => {
494494
const logger = new RecordingLogger();
495-
const result = dbConfig.mergeUserConfigs(
495+
const result = dbConfig.mergeDefaultSetupAndUserConfigs(
496496
logger,
497497
{ "threat-models": ["a", "b"] },
498498
{ "threat-models": ["local", "remote"] },
@@ -505,9 +505,13 @@ test("mergeUserConfigs - combines threat models", async (t) => {
505505
}
506506
});
507507

508-
test("mergeUserConfigs - warns if user-supplied config contains default setup key", async (t) => {
508+
test("mergeDefaultSetupAndUserConfigs - warns if user-supplied config contains default setup key", async (t) => {
509509
const logger = new RecordingLogger();
510-
const result = dbConfig.mergeUserConfigs(logger, {}, { "default-setup": {} });
510+
const result = dbConfig.mergeDefaultSetupAndUserConfigs(
511+
logger,
512+
{},
513+
{ "default-setup": {} },
514+
);
511515

512516
// User-supplied value is ignored.
513517
t.deepEqual(result, {});
@@ -520,12 +524,12 @@ test("mergeUserConfigs - warns if user-supplied config contains default setup ke
520524
);
521525
});
522526

523-
test("mergeUserConfigs - keeps default setup key from 'config' input", async (t) => {
527+
test("mergeDefaultSetupAndUserConfigs - keeps default setup key from 'config' input", async (t) => {
524528
const logger = new RecordingLogger();
525529
const expected: dbConfig.DefaultSetupConfig = {
526530
org: { "model-packs": ["some-pack"] },
527531
};
528-
const result = dbConfig.mergeUserConfigs(
532+
const result = dbConfig.mergeDefaultSetupAndUserConfigs(
529533
logger,
530534
{ "default-setup": expected },
531535
{},
@@ -542,14 +546,18 @@ test("mergeUserConfigs - keeps default setup key from 'config' input", async (t)
542546
);
543547
});
544548

545-
test("mergeUserConfigs - keeps other properties from user-supplied configuration", async (t) => {
549+
test("mergeDefaultSetupAndUserConfigs - keeps other properties from user-supplied configuration", async (t) => {
546550
const logger = new RecordingLogger();
547551
const configFile: dbConfig.UserConfig = {
548552
"query-filters": [{ exclude: { a: "b" } }],
549553
"paths-ignore": ["path"],
550554
};
551555

552-
const result = dbConfig.mergeUserConfigs(logger, {}, configFile);
556+
const result = dbConfig.mergeDefaultSetupAndUserConfigs(
557+
logger,
558+
{},
559+
configFile,
560+
);
553561

554562
t.deepEqual(result, configFile);
555563
});

src/config/db-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export interface UserConfig {
7575
* @param fromConfigFile The user-supplied configuration.
7676
* @returns The combination of both configuration files.
7777
*/
78-
export function mergeUserConfigs(
78+
export function mergeDefaultSetupAndUserConfigs(
7979
logger: Logger,
8080
fromConfigInput: UserConfig,
8181
fromConfigFile: UserConfig,

0 commit comments

Comments
 (0)