Skip to content

Commit 30383e4

Browse files
committed
Remove resolveQueries()
1 parent cb19286 commit 30383e4

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
@@ -120,13 +120,6 @@ export interface CodeQL {
120120
* Run 'codeql resolve languages' with '--format=betterjson'.
121121
*/
122122
betterResolveLanguages(): Promise<BetterResolveLanguagesOutput>;
123-
/**
124-
* Run 'codeql resolve queries'.
125-
*/
126-
resolveQueries(
127-
queries: string[],
128-
extraSearchPath: string | undefined,
129-
): Promise<ResolveQueriesOutput>;
130123
/**
131124
* Run 'codeql resolve build-environment'
132125
*/
@@ -239,20 +232,6 @@ export interface BetterResolveLanguagesOutput {
239232
};
240233
}
241234

242-
export interface ResolveQueriesOutput {
243-
byLanguage: {
244-
[language: string]: {
245-
[queryPath: string]: object;
246-
};
247-
};
248-
noDeclaredLanguage: {
249-
[queryPath: string]: object;
250-
};
251-
multipleDeclaredLanguages: {
252-
[queryPath: string]: object;
253-
};
254-
}
255-
256235
export interface ResolveBuildEnvironmentOutput {
257236
configuration?: {
258237
[language: string]: {
@@ -467,7 +446,6 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
467446
"betterResolveLanguages",
468447
async () => ({ aliases: {}, extractors: {} }),
469448
),
470-
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
471449
resolveBuildEnvironment: resolveFunction(
472450
partialCodeql,
473451
"resolveBuildEnvironment",
@@ -764,28 +742,6 @@ export async function getCodeQLForCmd(
764742
);
765743
}
766744
},
767-
async resolveQueries(
768-
queries: string[],
769-
extraSearchPath: string | undefined,
770-
) {
771-
const codeqlArgs = [
772-
"resolve",
773-
"queries",
774-
...queries,
775-
"--format=bylanguage",
776-
...getExtraOptionsFromEnv(["resolve", "queries"]),
777-
];
778-
if (extraSearchPath !== undefined) {
779-
codeqlArgs.push("--additional-packs", extraSearchPath);
780-
}
781-
const output = await runCli(cmd, codeqlArgs);
782-
783-
try {
784-
return JSON.parse(output) as ResolveQueriesOutput;
785-
} catch (e) {
786-
throw new Error(`Unexpected output from codeql resolve queries: ${e}`);
787-
}
788-
},
789745
async resolveBuildEnvironment(
790746
workingDir: string | undefined,
791747
language: string,

src/config-utils.test.ts

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,6 @@ test("load empty config", async (t) => {
131131
const languages = "javascript,python";
132132

133133
const codeql = setCodeQL({
134-
async resolveQueries() {
135-
return {
136-
byLanguage: {
137-
javascript: { queries: ["query1.ql"] },
138-
python: { queries: ["query2.ql"] },
139-
},
140-
noDeclaredLanguage: {},
141-
multipleDeclaredLanguages: {},
142-
};
143-
},
144134
async packDownload(): Promise<PackDownloadOutput> {
145135
return { packs: [] };
146136
},
@@ -175,16 +165,6 @@ test("loading config saves config", async (t) => {
175165
const logger = getRunnerLogger(true);
176166

177167
const codeql = setCodeQL({
178-
async resolveQueries() {
179-
return {
180-
byLanguage: {
181-
javascript: { queries: ["query1.ql"] },
182-
python: { queries: ["query2.ql"] },
183-
},
184-
noDeclaredLanguage: {},
185-
multipleDeclaredLanguages: {},
186-
};
187-
},
188168
async packDownload(): Promise<PackDownloadOutput> {
189169
return { packs: [] };
190170
},
@@ -306,18 +286,6 @@ test("load non-existent input", async (t) => {
306286
test("load non-empty input", async (t) => {
307287
return await withTmpDir(async (tempDir) => {
308288
const codeql = setCodeQL({
309-
async resolveQueries() {
310-
return {
311-
byLanguage: {
312-
javascript: {
313-
"/foo/a.ql": {},
314-
"/bar/b.ql": {},
315-
},
316-
},
317-
noDeclaredLanguage: {},
318-
multipleDeclaredLanguages: {},
319-
};
320-
},
321289
async packDownload(): Promise<PackDownloadOutput> {
322290
return { packs: [] };
323291
},
@@ -382,25 +350,6 @@ test("load non-empty input", async (t) => {
382350
});
383351
});
384352

385-
/**
386-
* Returns the provided queries, just in the right format for a resolved query
387-
* This way we can test by seeing which returned items are in the final
388-
* configuration.
389-
*/
390-
function queriesToResolvedQueryForm(queries: string[]) {
391-
const dummyResolvedQueries = {};
392-
for (const q of queries) {
393-
dummyResolvedQueries[q] = {};
394-
}
395-
return {
396-
byLanguage: {
397-
javascript: dummyResolvedQueries,
398-
},
399-
noDeclaredLanguage: {},
400-
multipleDeclaredLanguages: {},
401-
};
402-
}
403-
404353
test("Using config input and file together, config input should be used.", async (t) => {
405354
return await withTmpDir(async (tempDir) => {
406355
process.env["RUNNER_TEMP"] = tempDir;
@@ -425,18 +374,7 @@ test("Using config input and file together, config input should be used.", async
425374

426375
fs.mkdirSync(path.join(tempDir, "foo"));
427376

428-
const resolveQueriesArgs: Array<{
429-
queries: string[];
430-
extraSearchPath: string | undefined;
431-
}> = [];
432377
const codeql = setCodeQL({
433-
async resolveQueries(
434-
queries: string[],
435-
extraSearchPath: string | undefined,
436-
) {
437-
resolveQueriesArgs.push({ queries, extraSearchPath });
438-
return queriesToResolvedQueryForm(queries);
439-
},
440378
async packDownload(): Promise<PackDownloadOutput> {
441379
return { packs: [] };
442380
},
@@ -463,17 +401,6 @@ test("Using config input and file together, config input should be used.", async
463401
test("API client used when reading remote config", async (t) => {
464402
return await withTmpDir(async (tempDir) => {
465403
const codeql = setCodeQL({
466-
async resolveQueries() {
467-
return {
468-
byLanguage: {
469-
javascript: {
470-
"foo.ql": {},
471-
},
472-
},
473-
noDeclaredLanguage: {},
474-
multipleDeclaredLanguages: {},
475-
};
476-
},
477404
async packDownload(): Promise<PackDownloadOutput> {
478405
return { packs: [] };
479406
},

0 commit comments

Comments
 (0)