diff --git a/src/codeql.ts b/src/codeql.ts index 594b58eb2..e34466e6f 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -128,13 +128,6 @@ export interface CodeQL { * Run 'codeql resolve languages' with '--format=betterjson'. */ betterResolveLanguages(): Promise; - /** - * Run 'codeql resolve queries'. - */ - resolveQueries( - queries: string[], - extraSearchPath: string | undefined, - ): Promise; /** * Run 'codeql resolve build-environment' */ @@ -255,20 +248,6 @@ export interface BetterResolveLanguagesOutput { }; } -export interface ResolveQueriesOutput { - byLanguage: { - [language: string]: { - [queryPath: string]: object; - }; - }; - noDeclaredLanguage: { - [queryPath: string]: object; - }; - multipleDeclaredLanguages: { - [queryPath: string]: object; - }; -} - export interface ResolveBuildEnvironmentOutput { configuration?: { [language: string]: { @@ -495,7 +474,6 @@ export function createStubCodeQL(partialCodeql: Partial): CodeQL { "betterResolveLanguages", async () => ({ aliases: {}, extractors: {} }), ), - resolveQueries: resolveFunction(partialCodeql, "resolveQueries"), resolveBuildEnvironment: resolveFunction( partialCodeql, "resolveBuildEnvironment", @@ -792,28 +770,6 @@ export async function getCodeQLForCmd( ); } }, - async resolveQueries( - queries: string[], - extraSearchPath: string | undefined, - ) { - const codeqlArgs = [ - "resolve", - "queries", - ...queries, - "--format=bylanguage", - ...getExtraOptionsFromEnv(["resolve", "queries"]), - ]; - if (extraSearchPath !== undefined) { - codeqlArgs.push("--additional-packs", extraSearchPath); - } - const output = await runCli(cmd, codeqlArgs); - - try { - return JSON.parse(output) as ResolveQueriesOutput; - } catch (e) { - throw new Error(`Unexpected output from codeql resolve queries: ${e}`); - } - }, async resolveBuildEnvironment( workingDir: string | undefined, language: string, diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts index 815c7b893..cd47fac05 100644 --- a/src/config-utils.test.ts +++ b/src/config-utils.test.ts @@ -143,16 +143,6 @@ test("load empty config", async (t) => { }, }; }, - async resolveQueries() { - return { - byLanguage: { - javascript: { queries: ["query1.ql"] }, - python: { queries: ["query2.ql"] }, - }, - noDeclaredLanguage: {}, - multipleDeclaredLanguages: {}, - }; - }, async packDownload(): Promise { return { packs: [] }; }, @@ -195,16 +185,6 @@ test("loading config saves config", async (t) => { }, }; }, - async resolveQueries() { - return { - byLanguage: { - javascript: { queries: ["query1.ql"] }, - python: { queries: ["query2.ql"] }, - }, - noDeclaredLanguage: {}, - multipleDeclaredLanguages: {}, - }; - }, async packDownload(): Promise { return { packs: [] }; }, @@ -330,18 +310,6 @@ test("load non-empty input", async (t) => { }, }; }, - async resolveQueries() { - return { - byLanguage: { - javascript: { - "/foo/a.ql": {}, - "/bar/b.ql": {}, - }, - }, - noDeclaredLanguage: {}, - multipleDeclaredLanguages: {}, - }; - }, async packDownload(): Promise { return { packs: [] }; }, @@ -406,25 +374,6 @@ test("load non-empty input", async (t) => { }); }); -/** - * Returns the provided queries, just in the right format for a resolved query - * This way we can test by seeing which returned items are in the final - * configuration. - */ -function queriesToResolvedQueryForm(queries: string[]) { - const dummyResolvedQueries = {}; - for (const q of queries) { - dummyResolvedQueries[q] = {}; - } - return { - byLanguage: { - javascript: dummyResolvedQueries, - }, - noDeclaredLanguage: {}, - multipleDeclaredLanguages: {}, - }; -} - test("Using config input and file together, config input should be used.", async (t) => { return await withTmpDir(async (tempDir) => { process.env["RUNNER_TEMP"] = tempDir; @@ -449,10 +398,6 @@ test("Using config input and file together, config input should be used.", async fs.mkdirSync(path.join(tempDir, "foo")); - const resolveQueriesArgs: Array<{ - queries: string[]; - extraSearchPath: string | undefined; - }> = []; const codeql = createStubCodeQL({ async betterResolveLanguages() { return { @@ -462,13 +407,6 @@ test("Using config input and file together, config input should be used.", async }, }; }, - async resolveQueries( - queries: string[], - extraSearchPath: string | undefined, - ) { - resolveQueriesArgs.push({ queries, extraSearchPath }); - return queriesToResolvedQueryForm(queries); - }, async packDownload(): Promise { return { packs: [] }; }, @@ -502,17 +440,6 @@ test("API client used when reading remote config", async (t) => { }, }; }, - async resolveQueries() { - return { - byLanguage: { - javascript: { - "foo.ql": {}, - }, - }, - noDeclaredLanguage: {}, - multipleDeclaredLanguages: {}, - }; - }, async packDownload(): Promise { return { packs: [] }; },