Skip to content

Commit bec6a25

Browse files
committed
Remove resolveQueries()
1 parent d71ebcc commit bec6a25

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
*/
@@ -247,20 +240,6 @@ export interface BetterResolveLanguagesOutput {
247240
};
248241
}
249242

250-
export interface ResolveQueriesOutput {
251-
byLanguage: {
252-
[language: string]: {
253-
[queryPath: string]: object;
254-
};
255-
};
256-
noDeclaredLanguage: {
257-
[queryPath: string]: object;
258-
};
259-
multipleDeclaredLanguages: {
260-
[queryPath: string]: object;
261-
};
262-
}
263-
264243
export interface ResolveBuildEnvironmentOutput {
265244
configuration?: {
266245
[language: string]: {
@@ -475,7 +454,6 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
475454
"betterResolveLanguages",
476455
async () => ({ aliases: {}, extractors: {} }),
477456
),
478-
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
479457
resolveBuildEnvironment: resolveFunction(
480458
partialCodeql,
481459
"resolveBuildEnvironment",
@@ -772,28 +750,6 @@ export async function getCodeQLForCmd(
772750
);
773751
}
774752
},
775-
async resolveQueries(
776-
queries: string[],
777-
extraSearchPath: string | undefined,
778-
) {
779-
const codeqlArgs = [
780-
"resolve",
781-
"queries",
782-
...queries,
783-
"--format=bylanguage",
784-
...getExtraOptionsFromEnv(["resolve", "queries"]),
785-
];
786-
if (extraSearchPath !== undefined) {
787-
codeqlArgs.push("--additional-packs", extraSearchPath);
788-
}
789-
const output = await runCli(cmd, codeqlArgs);
790-
791-
try {
792-
return JSON.parse(output) as ResolveQueriesOutput;
793-
} catch (e) {
794-
throw new Error(`Unexpected output from codeql resolve queries: ${e}`);
795-
}
796-
},
797753
async resolveBuildEnvironment(
798754
workingDir: string | undefined,
799755
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)