Skip to content

Commit a71ebf3

Browse files
committed
Remove resolveQueries()
1 parent da8dabf commit a71ebf3

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
@@ -143,16 +143,6 @@ test("load empty config", async (t) => {
143143
},
144144
};
145145
},
146-
async resolveQueries() {
147-
return {
148-
byLanguage: {
149-
javascript: { queries: ["query1.ql"] },
150-
python: { queries: ["query2.ql"] },
151-
},
152-
noDeclaredLanguage: {},
153-
multipleDeclaredLanguages: {},
154-
};
155-
},
156146
async packDownload(): Promise<PackDownloadOutput> {
157147
return { packs: [] };
158148
},
@@ -195,16 +185,6 @@ test("loading config saves config", async (t) => {
195185
},
196186
};
197187
},
198-
async resolveQueries() {
199-
return {
200-
byLanguage: {
201-
javascript: { queries: ["query1.ql"] },
202-
python: { queries: ["query2.ql"] },
203-
},
204-
noDeclaredLanguage: {},
205-
multipleDeclaredLanguages: {},
206-
};
207-
},
208188
async packDownload(): Promise<PackDownloadOutput> {
209189
return { packs: [] };
210190
},
@@ -330,18 +310,6 @@ test("load non-empty input", async (t) => {
330310
},
331311
};
332312
},
333-
async resolveQueries() {
334-
return {
335-
byLanguage: {
336-
javascript: {
337-
"/foo/a.ql": {},
338-
"/bar/b.ql": {},
339-
},
340-
},
341-
noDeclaredLanguage: {},
342-
multipleDeclaredLanguages: {},
343-
};
344-
},
345313
async packDownload(): Promise<PackDownloadOutput> {
346314
return { packs: [] };
347315
},
@@ -406,25 +374,6 @@ test("load non-empty input", async (t) => {
406374
});
407375
});
408376

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

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

452-
const resolveQueriesArgs: Array<{
453-
queries: string[];
454-
extraSearchPath: string | undefined;
455-
}> = [];
456401
const codeql = createStubCodeQL({
457402
async betterResolveLanguages() {
458403
return {
@@ -462,13 +407,6 @@ test("Using config input and file together, config input should be used.", async
462407
},
463408
};
464409
},
465-
async resolveQueries(
466-
queries: string[],
467-
extraSearchPath: string | undefined,
468-
) {
469-
resolveQueriesArgs.push({ queries, extraSearchPath });
470-
return queriesToResolvedQueryForm(queries);
471-
},
472410
async packDownload(): Promise<PackDownloadOutput> {
473411
return { packs: [] };
474412
},
@@ -502,17 +440,6 @@ test("API client used when reading remote config", async (t) => {
502440
},
503441
};
504442
},
505-
async resolveQueries() {
506-
return {
507-
byLanguage: {
508-
javascript: {
509-
"foo.ql": {},
510-
},
511-
},
512-
noDeclaredLanguage: {},
513-
multipleDeclaredLanguages: {},
514-
};
515-
},
516443
async packDownload(): Promise<PackDownloadOutput> {
517444
return { packs: [] };
518445
},

0 commit comments

Comments
 (0)