Skip to content

Commit 3305d21

Browse files
committed
Move UserConfig to its own file
1 parent 12dda79 commit 3305d21

File tree

2 files changed

+35
-33
lines changed

2 files changed

+35
-33
lines changed

src/config-utils.ts

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
import * as api from "./api-client";
1818
import { CachingKind, getCachingKind } from "./caching-utils";
1919
import { type CodeQL } from "./codeql";
20+
import { ExcludeQueryFilter, UserConfig } from "./config/db-config";
2021
import { shouldPerformDiffInformedAnalysis } from "./diff-informed-analysis-utils";
2122
import { Feature, FeatureEnablement } from "./feature-flags";
2223
import { getGitRoot, isAnalyzingDefaultBranch } from "./git-utils";
@@ -38,35 +39,12 @@ import {
3839
isDefined,
3940
} from "./util";
4041

42+
export * from "./config/db-config";
43+
4144
// Property names from the user-supplied config file.
4245

4346
const PACKS_PROPERTY = "packs";
4447

45-
/**
46-
* Format of the config file supplied by the user.
47-
*/
48-
export interface UserConfig {
49-
name?: string;
50-
"disable-default-queries"?: boolean;
51-
queries?: Array<{
52-
name?: string;
53-
uses: string;
54-
}>;
55-
"paths-ignore"?: string[];
56-
paths?: string[];
57-
58-
// If this is a multi-language analysis, then the packages must be split by
59-
// language. If this is a single language analysis, then no split by
60-
// language is necessary.
61-
packs?: Record<string, string[]> | string[];
62-
63-
// Set of query filters to include and exclude extra queries based on
64-
// codeql query suite `include` and `exclude` properties
65-
"query-filters"?: QueryFilter[];
66-
}
67-
68-
export type QueryFilter = ExcludeQueryFilter | IncludeQueryFilter;
69-
7048
export type RegistryConfigWithCredentials = RegistryConfigNoCredentials & {
7149
// Token to use when downloading packs from this registry.
7250
token: string;
@@ -90,14 +68,6 @@ export interface RegistryConfigNoCredentials {
9068
kind?: "github" | "docker";
9169
}
9270

93-
interface ExcludeQueryFilter {
94-
exclude: Record<string, string[] | string>;
95-
}
96-
97-
interface IncludeQueryFilter {
98-
include: Record<string, string[] | string>;
99-
}
100-
10171
/**
10272
* Format of the parsed config file.
10373
*/

src/config/db-config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export interface ExcludeQueryFilter {
2+
exclude: Record<string, string[] | string>;
3+
}
4+
5+
export interface IncludeQueryFilter {
6+
include: Record<string, string[] | string>;
7+
}
8+
9+
export type QueryFilter = ExcludeQueryFilter | IncludeQueryFilter;
10+
11+
/**
12+
* Format of the config file supplied by the user.
13+
*/
14+
export interface UserConfig {
15+
name?: string;
16+
"disable-default-queries"?: boolean;
17+
queries?: Array<{
18+
name?: string;
19+
uses: string;
20+
}>;
21+
"paths-ignore"?: string[];
22+
paths?: string[];
23+
24+
// If this is a multi-language analysis, then the packages must be split by
25+
// language. If this is a single language analysis, then no split by
26+
// language is necessary.
27+
packs?: Record<string, string[]> | string[];
28+
29+
// Set of query filters to include and exclude extra queries based on
30+
// codeql query suite `include` and `exclude` properties
31+
"query-filters"?: QueryFilter[];
32+
}

0 commit comments

Comments
 (0)