Skip to content

Commit 64fce58

Browse files
committed
Use exclude-from-incremental also for overlay analysis
1 parent fe7205c commit 64fce58

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

src/config-utils.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -818,13 +818,10 @@ const calculateAugmentationMacro = test.macro({
818818
) => {
819819
const actualAugmentationProperties =
820820
await configUtils.calculateAugmentation(
821-
getCachedCodeQL(),
822-
createFeatures([]),
823821
rawPacksInput,
824822
rawQueriesInput,
825823
rawQualityQueriesInput,
826824
languages,
827-
mockLogger,
828825
);
829826
t.deepEqual(actualAugmentationProperties, expectedAugmentationProperties);
830827
},
@@ -947,13 +944,10 @@ const calculateAugmentationErrorMacro = test.macro({
947944
await t.throwsAsync(
948945
() =>
949946
configUtils.calculateAugmentation(
950-
getCachedCodeQL(),
951-
createFeatures([]),
952947
rawPacksInput,
953948
rawQueriesInput,
954949
rawQualityQueriesInput,
955950
languages,
956-
mockLogger,
957951
),
958952
{ message: expectedError },
959953
);

src/config-utils.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export interface AugmentationProperties {
195195
/**
196196
* Extra query exclusions to append to the config.
197197
*/
198-
extraQueryExclusions?: ExcludeQueryFilter[];
198+
extraQueryExclusions: ExcludeQueryFilter[];
199199

200200
/**
201201
* The overlay database mode to use.
@@ -496,13 +496,10 @@ export async function getDefaultConfig({
496496
);
497497

498498
const augmentationProperties = await calculateAugmentation(
499-
codeql,
500-
features,
501499
packsInput,
502500
queriesInput,
503501
qualityQueriesInput,
504502
languages,
505-
logger,
506503
);
507504

508505
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
@@ -579,14 +576,11 @@ async function loadUserConfig(
579576
* and the CLI does not know about these inputs so we need to inject them into
580577
* the config file sent to the CLI.
581578
*
582-
* @param codeql The CodeQL object.
583-
* @param features The feature enablement object.
584579
* @param rawPacksInput The packs input from the action configuration.
585580
* @param rawQueriesInput The queries input from the action configuration.
586581
* @param languages The languages that the config file is for. If the packs input
587582
* is non-empty, then there must be exactly one language. Otherwise, an
588583
* error is thrown.
589-
* @param logger The logger to use for logging.
590584
*
591585
* @returns The properties that need to be augmented in the config file.
592586
*
@@ -595,13 +589,10 @@ async function loadUserConfig(
595589
*/
596590
// exported for testing.
597591
export async function calculateAugmentation(
598-
codeql: CodeQL,
599-
features: FeatureEnablement,
600592
rawPacksInput: string | undefined,
601593
rawQueriesInput: string | undefined,
602594
rawQualityQueriesInput: string | undefined,
603595
languages: Language[],
604-
logger: Logger,
605596
): Promise<AugmentationProperties> {
606597
const packsInputCombines = shouldCombine(rawPacksInput);
607598
const packsInput = parsePacksFromInput(
@@ -620,20 +611,13 @@ export async function calculateAugmentation(
620611
false,
621612
);
622613

623-
const extraQueryExclusions: ExcludeQueryFilter[] = [];
624-
if (await shouldPerformDiffInformedAnalysis(codeql, features, logger)) {
625-
extraQueryExclusions.push({
626-
exclude: { tags: "exclude-from-incremental" },
627-
});
628-
}
629-
630614
return {
631615
packsInputCombines,
632616
packsInput: packsInput?.[languages[0]],
633617
queriesInput,
634618
queriesInputCombines,
635619
qualityQueriesInput,
636-
extraQueryExclusions,
620+
extraQueryExclusions: [],
637621
overlayDatabaseMode: OverlayDatabaseMode.None,
638622
useOverlayDatabaseCaching: false,
639623
};
@@ -999,6 +983,19 @@ export async function initConfig(inputs: InitConfigInputs): Promise<Config> {
999983
augmentationProperties.overlayDatabaseMode = overlayDatabaseMode;
1000984
augmentationProperties.useOverlayDatabaseCaching = useOverlayDatabaseCaching;
1001985

986+
if (
987+
overlayDatabaseMode === OverlayDatabaseMode.Overlay ||
988+
(await shouldPerformDiffInformedAnalysis(
989+
inputs.codeql,
990+
inputs.features,
991+
logger,
992+
))
993+
) {
994+
augmentationProperties.extraQueryExclusions.push({
995+
exclude: { tags: "exclude-from-incremental" },
996+
});
997+
}
998+
1002999
// Save the config so we can easily access it again in the future
10031000
await saveConfig(config, logger);
10041001
return config;

src/testing-utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ export function createTestConfig(overrides: Partial<Config>): Config {
335335
augmentationProperties: {
336336
packsInputCombines: false,
337337
queriesInputCombines: false,
338+
extraQueryExclusions: [],
338339
},
339340
trapCaches: {},
340341
trapCacheDownloadTime: 0,

0 commit comments

Comments
 (0)