Skip to content

Commit c7dd894

Browse files
committed
Remove resolveQueries()
1 parent e5ff5c6 commit c7dd894

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]: {
@@ -485,7 +464,6 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
485464
"betterResolveLanguages",
486465
async () => ({ aliases: {}, extractors: {} }),
487466
),
488-
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
489467
resolveBuildEnvironment: resolveFunction(
490468
partialCodeql,
491469
"resolveBuildEnvironment",
@@ -794,28 +772,6 @@ export async function getCodeQLForCmd(
794772
);
795773
}
796774
},
797-
async resolveQueries(
798-
queries: string[],
799-
extraSearchPath: string | undefined,
800-
) {
801-
const codeqlArgs = [
802-
"resolve",
803-
"queries",
804-
...queries,
805-
"--format=bylanguage",
806-
...getExtraOptionsFromEnv(["resolve", "queries"]),
807-
];
808-
if (extraSearchPath !== undefined) {
809-
codeqlArgs.push("--additional-packs", extraSearchPath);
810-
}
811-
const output = await runCli(cmd, codeqlArgs);
812-
813-
try {
814-
return JSON.parse(output) as ResolveQueriesOutput;
815-
} catch (e) {
816-
throw new Error(`Unexpected output from codeql resolve queries: ${e}`);
817-
}
818-
},
819775
async resolveBuildEnvironment(
820776
workingDir: string | undefined,
821777
language: string,

src/config-utils.test.ts

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,6 @@ test("load empty config", async (t) => {
139139
},
140140
};
141141
},
142-
async resolveQueries() {
143-
return {
144-
byLanguage: {
145-
javascript: { queries: ["query1.ql"] },
146-
python: { queries: ["query2.ql"] },
147-
},
148-
noDeclaredLanguage: {},
149-
multipleDeclaredLanguages: {},
150-
};
151-
},
152142
async packDownload(): Promise<PackDownloadOutput> {
153143
return { packs: [] };
154144
},
@@ -191,16 +181,6 @@ test("loading config saves config", async (t) => {
191181
},
192182
};
193183
},
194-
async resolveQueries() {
195-
return {
196-
byLanguage: {
197-
javascript: { queries: ["query1.ql"] },
198-
python: { queries: ["query2.ql"] },
199-
},
200-
noDeclaredLanguage: {},
201-
multipleDeclaredLanguages: {},
202-
};
203-
},
204184
async packDownload(): Promise<PackDownloadOutput> {
205185
return { packs: [] };
206186
},
@@ -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 = setCodeQL({
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)