Add resolveQueries to CodeQL CLI

This commit is contained in:
Robert
2023-05-19 12:18:14 +01:00
parent a3f2b7b1ca
commit 13f8f19339

View File

@@ -134,6 +134,11 @@ export interface SourceInfo {
sourceLocationPrefix: string;
}
/**
* The expected output of `codeql resolve queries`.
*/
export type ResolvedQueries = string[];
/**
* The expected output of `codeql resolve tests`.
*/
@@ -731,6 +736,20 @@ export class CodeQLCliServer implements Disposable {
);
}
/**
* Finds all available queries in a given directory.
* @param queryDir Root of directory tree to search for queries.
* @returns The list of queries that were found.
*/
public async resolveQueries(queryDir: string): Promise<ResolvedQueries> {
const subcommandArgs = [queryDir];
return await this.runJsonCodeQlCliCommand<ResolvedQueries>(
["resolve", "queries"],
subcommandArgs,
"Resolving queries",
);
}
/**
* Finds all available QL tests in a given directory.
* @param testPath Root of directory tree to search for tests.