Skip to content

Commit 4ac0377

Browse files
committed
Remove resolveQueries()
1 parent 9ccc48a commit 4ac0377

File tree

2 files changed

+0
-117
lines changed

2 files changed

+0
-117
lines changed

src/codeql.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ export interface CodeQL {
128128
* Run 'codeql resolve languages' with '--format=betterjson'.
129129
*/
130130
betterResolveLanguages(): Promise<BetterResolveLanguagesOutput>;
131-
/**
132-
* Run 'codeql resolve queries'.
133-
*/
134-
resolveQueries(
135-
queries: string[],
136-
extraSearchPath: string | undefined,
137-
): Promise<ResolveQueriesOutput>;
138131
/**
139132
* Run 'codeql resolve build-environment'
140133
*/
@@ -255,20 +248,6 @@ export interface BetterResolveLanguagesOutput {
255248
};
256249
}
257250

258-
export interface ResolveQueriesOutput {
259-
byLanguage: {
260-
[language: string]: {
261-
[queryPath: string]: object;
262-
};
263-
};
264-
noDeclaredLanguage: {
265-
[queryPath: string]: object;
266-
};
267-
multipleDeclaredLanguages: {
268-
[queryPath: string]: object;
269-
};
270-
}
271-
272251
export interface ResolveBuildEnvironmentOutput {
273252
configuration?: {
274253
[language: string]: {
@@ -495,7 +474,6 @@ export function createStubCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
495474
"betterResolveLanguages",
496475
async () => ({ aliases: {}, extractors: {} }),
497476
),
498-
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
499477
resolveBuildEnvironment: resolveFunction(
500478
partialCodeql,
501479
"resolveBuildEnvironment",
@@ -792,28 +770,6 @@ export async function getCodeQLForCmd(
792770
);
793771
}
794772
},
795-
async resolveQueries(
796-
queries: string[],
797-
extraSearchPath: string | undefined,
798-
) {
799-
const codeqlArgs = [
800-
"resolve",
801-
"queries",
802-
...queries,
803-
"--format=bylanguage",
804-
...getExtraOptionsFromEnv(["resolve", "queries"]),
805-
];
806-
if (extraSearchPath !== undefined) {
807-
codeqlArgs.push("--additional-packs", extraSearchPath);
808-
}
809-
const output = await runCli(cmd, codeqlArgs);
810-
811-
try {
812-
return JSON.parse(output) as ResolveQueriesOutput;
813-
} catch (e) {
814-
throw new Error(`Unexpected output from codeql resolve queries: ${e}`);
815-
}
816-
},
817773
async resolveBuildEnvironment(
818774
workingDir: string | undefined,
819775
language: string,

src/config-utils.test.ts

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,6 @@ test("load empty config", async (t) => {
142142
},
143143
};
144144
},
145-
async resolveQueries() {
146-
return {
147-
byLanguage: {
148-
javascript: { queries: ["query1.ql"] },
149-
python: { queries: ["query2.ql"] },
150-
},
151-
noDeclaredLanguage: {},
152-
multipleDeclaredLanguages: {},
153-
};
154-
},
155145
async packDownload(): Promise<PackDownloadOutput> {
156146
return { packs: [] };
157147
},
@@ -194,16 +184,6 @@ test("loading config saves config", async (t) => {
194184
},
195185
};
196186
},
197-
async resolveQueries() {
198-
return {
199-
byLanguage: {
200-
javascript: { queries: ["query1.ql"] },
201-
python: { queries: ["query2.ql"] },
202-
},
203-
noDeclaredLanguage: {},
204-
multipleDeclaredLanguages: {},
205-
};
206-
},
207187
async packDownload(): Promise<PackDownloadOutput> {
208188
return { packs: [] };
209189
},
@@ -329,18 +309,6 @@ test("load non-empty input", async (t) => {
329309
},
330310
};
331311
},
332-
async resolveQueries() {
333-
return {
334-
byLanguage: {
335-
javascript: {
336-
"/foo/a.ql": {},
337-
"/bar/b.ql": {},
338-
},
339-
},
340-
noDeclaredLanguage: {},
341-
multipleDeclaredLanguages: {},
342-
};
343-
},
344312
async packDownload(): Promise<PackDownloadOutput> {
345313
return { packs: [] };
346314
},
@@ -405,25 +373,6 @@ test("load non-empty input", async (t) => {
405373
});
406374
});
407375

408-
/**
409-
* Returns the provided queries, just in the right format for a resolved query
410-
* This way we can test by seeing which returned items are in the final
411-
* configuration.
412-
*/
413-
function queriesToResolvedQueryForm(queries: string[]) {
414-
const dummyResolvedQueries = {};
415-
for (const q of queries) {
416-
dummyResolvedQueries[q] = {};
417-
}
418-
return {
419-
byLanguage: {
420-
javascript: dummyResolvedQueries,
421-
},
422-
noDeclaredLanguage: {},
423-
multipleDeclaredLanguages: {},
424-
};
425-
}
426-
427376
test("Using config input and file together, config input should be used.", async (t) => {
428377
return await withTmpDir(async (tempDir) => {
429378
process.env["RUNNER_TEMP"] = tempDir;
@@ -448,10 +397,6 @@ test("Using config input and file together, config input should be used.", async
448397

449398
fs.mkdirSync(path.join(tempDir, "foo"));
450399

451-
const resolveQueriesArgs: Array<{
452-
queries: string[];
453-
extraSearchPath: string | undefined;
454-
}> = [];
455400
const codeql = createStubCodeQL({
456401
async betterResolveLanguages() {
457402
return {
@@ -461,13 +406,6 @@ test("Using config input and file together, config input should be used.", async
461406
},
462407
};
463408
},
464-
async resolveQueries(
465-
queries: string[],
466-
extraSearchPath: string | undefined,
467-
) {
468-
resolveQueriesArgs.push({ queries, extraSearchPath });
469-
return queriesToResolvedQueryForm(queries);
470-
},
471409
async packDownload(): Promise<PackDownloadOutput> {
472410
return { packs: [] };
473411
},
@@ -501,17 +439,6 @@ test("API client used when reading remote config", async (t) => {
501439
},
502440
};
503441
},
504-
async resolveQueries() {
505-
return {
506-
byLanguage: {
507-
javascript: {
508-
"foo.ql": {},
509-
},
510-
},
511-
noDeclaredLanguage: {},
512-
multipleDeclaredLanguages: {},
513-
};
514-
},
515442
async packDownload(): Promise<PackDownloadOutput> {
516443
return { packs: [] };
517444
},

0 commit comments

Comments
 (0)