From 3305d21389549cc8bb6dd9e6f6d7d8fd66d286bf Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 19 Sep 2025 16:34:34 +0100 Subject: [PATCH] Move `UserConfig` to its own file --- src/config-utils.ts | 36 +++--------------------------------- src/config/db-config.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 33 deletions(-) create mode 100644 src/config/db-config.ts diff --git a/src/config-utils.ts b/src/config-utils.ts index 538c366e8..574b27528 100644 --- a/src/config-utils.ts +++ b/src/config-utils.ts @@ -17,6 +17,7 @@ import { import * as api from "./api-client"; import { CachingKind, getCachingKind } from "./caching-utils"; import { type CodeQL } from "./codeql"; +import { ExcludeQueryFilter, UserConfig } from "./config/db-config"; import { shouldPerformDiffInformedAnalysis } from "./diff-informed-analysis-utils"; import { Feature, FeatureEnablement } from "./feature-flags"; import { getGitRoot, isAnalyzingDefaultBranch } from "./git-utils"; @@ -38,35 +39,12 @@ import { isDefined, } from "./util"; +export * from "./config/db-config"; + // Property names from the user-supplied config file. const PACKS_PROPERTY = "packs"; -/** - * Format of the config file supplied by the user. - */ -export interface UserConfig { - name?: string; - "disable-default-queries"?: boolean; - queries?: Array<{ - name?: string; - uses: string; - }>; - "paths-ignore"?: string[]; - paths?: string[]; - - // If this is a multi-language analysis, then the packages must be split by - // language. If this is a single language analysis, then no split by - // language is necessary. - packs?: Record | string[]; - - // Set of query filters to include and exclude extra queries based on - // codeql query suite `include` and `exclude` properties - "query-filters"?: QueryFilter[]; -} - -export type QueryFilter = ExcludeQueryFilter | IncludeQueryFilter; - export type RegistryConfigWithCredentials = RegistryConfigNoCredentials & { // Token to use when downloading packs from this registry. token: string; @@ -90,14 +68,6 @@ export interface RegistryConfigNoCredentials { kind?: "github" | "docker"; } -interface ExcludeQueryFilter { - exclude: Record; -} - -interface IncludeQueryFilter { - include: Record; -} - /** * Format of the parsed config file. */ diff --git a/src/config/db-config.ts b/src/config/db-config.ts new file mode 100644 index 000000000..53659a399 --- /dev/null +++ b/src/config/db-config.ts @@ -0,0 +1,32 @@ +export interface ExcludeQueryFilter { + exclude: Record; +} + +export interface IncludeQueryFilter { + include: Record; +} + +export type QueryFilter = ExcludeQueryFilter | IncludeQueryFilter; + +/** + * Format of the config file supplied by the user. + */ +export interface UserConfig { + name?: string; + "disable-default-queries"?: boolean; + queries?: Array<{ + name?: string; + uses: string; + }>; + "paths-ignore"?: string[]; + paths?: string[]; + + // If this is a multi-language analysis, then the packages must be split by + // language. If this is a single language analysis, then no split by + // language is necessary. + packs?: Record | string[]; + + // Set of query filters to include and exclude extra queries based on + // codeql query suite `include` and `exclude` properties + "query-filters"?: QueryFilter[]; +}