Remove use of Pick in auto model usages query

This commit is contained in:
Koen Vlaswinkel
2023-05-31 13:51:51 +02:00
parent a4d875af8d
commit 1920a2c6b4
5 changed files with 10 additions and 28 deletions

View File

@@ -8,19 +8,9 @@ import { interpretResultsSarif } from "../query-results";
import { ProgressCallback } from "../common/vscode/progress";
type Options = {
cliServer: Pick<
CodeQLCliServer,
"resolveDatabase" | "resolveQlpacks" | "interpretBqrsSarif"
>;
queryRunner: Pick<QueryRunner, "createQueryRun" | "logger">;
databaseItem: Pick<
DatabaseItem,
| "contents"
| "databaseUri"
| "language"
| "sourceArchive"
| "getSourceLocationPrefix"
>;
cliServer: CodeQLCliServer;
queryRunner: QueryRunner;
databaseItem: DatabaseItem;
queryStorageDir: string;
progress: ProgressCallback;

View File

@@ -121,9 +121,7 @@ export class DatabaseItemImpl implements DatabaseItem {
/**
* Returns information about a database.
*/
private async getDbInfo(
server: Pick<cli.CodeQLCliServer, "resolveDatabase">,
): Promise<cli.DbInfo> {
private async getDbInfo(server: cli.CodeQLCliServer): Promise<cli.DbInfo> {
if (this._dbinfo === undefined) {
this._dbinfo = await server.resolveDatabase(this.databaseUri.fsPath);
}
@@ -135,7 +133,7 @@ export class DatabaseItemImpl implements DatabaseItem {
* has a `.dbinfo` file, which is the source of the prefix.
*/
public async getSourceLocationPrefix(
server: Pick<cli.CodeQLCliServer, "resolveDatabase">,
server: cli.CodeQLCliServer,
): Promise<string> {
const dbInfo = await this.getDbInfo(server);
return dbInfo.sourceLocationPrefix;
@@ -144,9 +142,7 @@ export class DatabaseItemImpl implements DatabaseItem {
/**
* Returns path to dataset folder of database.
*/
public async getDatasetFolder(
server: Pick<cli.CodeQLCliServer, "resolveDatabase">,
): Promise<string> {
public async getDatasetFolder(server: cli.CodeQLCliServer): Promise<string> {
const dbInfo = await this.getDbInfo(server);
return dbInfo.datasetFolder;
}

View File

@@ -43,16 +43,12 @@ export interface DatabaseItem {
/**
* Returns `sourceLocationPrefix` of exported database.
*/
getSourceLocationPrefix(
server: Pick<cli.CodeQLCliServer, "resolveDatabase">,
): Promise<string>;
getSourceLocationPrefix(server: cli.CodeQLCliServer): Promise<string>;
/**
* Returns dataset folder of exported database.
*/
getDatasetFolder(
server: Pick<cli.CodeQLCliServer, "resolveDatabase">,
): Promise<string>;
getDatasetFolder(server: cli.CodeQLCliServer): Promise<string>;
/**
* Returns the root uri of the virtual filesystem for this database's source archive,

View File

@@ -786,7 +786,7 @@ export async function askForLanguage(
* @returns A promise that resolves to the query metadata, if available.
*/
export async function tryGetQueryMetadata(
cliServer: Pick<CodeQLCliServer, "resolveMetadata">,
cliServer: CodeQLCliServer,
queryPath: string,
): Promise<QueryMetadata | undefined> {
try {

View File

@@ -135,7 +135,7 @@ export class CompletedQueryInfo implements QueryWithResults {
* Call cli command to interpret SARIF results.
*/
export async function interpretResultsSarif(
cli: Pick<cli.CodeQLCliServer, "interpretBqrsSarif">,
cli: cli.CodeQLCliServer,
metadata: QueryMetadata | undefined,
resultsPaths: ResultsPaths,
sourceInfo?: cli.SourceInfo,