Skip to content

Commit 0f90319

Browse files
committed
Use an options object for runAsyncCodeQlCliCommand
This also removes the type for the `runTests` `options` argument since it's only used in this definition and don't actually use the type anywhere else.
1 parent 8afdabd commit 0f90319

File tree

1 file changed

+27
-20
lines changed
  • extensions/ql-vscode/src

1 file changed

+27
-20
lines changed

extensions/ql-vscode/src/cli.ts

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,6 @@ export interface SourceInfo {
124124
*/
125125
export type ResolvedTests = string[];
126126

127-
/**
128-
* Options for `codeql test run`.
129-
*/
130-
export interface TestRunOptions {
131-
cancellationToken?: CancellationToken;
132-
logger?: Logger;
133-
}
134-
135127
/**
136128
* Event fired by `codeql test run`.
137129
*/
@@ -485,8 +477,13 @@ export class CodeQLCliServer implements Disposable {
485477
command: string[],
486478
commandArgs: string[],
487479
description: string,
488-
cancellationToken?: CancellationToken,
489-
logger?: Logger,
480+
{
481+
cancellationToken,
482+
logger,
483+
}: {
484+
cancellationToken?: CancellationToken;
485+
logger?: Logger;
486+
} = {},
490487
): AsyncGenerator<EventType, void, unknown> {
491488
for await (const event of this.runAsyncCodeQlCliCommandInternal(
492489
command,
@@ -519,8 +516,13 @@ export class CodeQLCliServer implements Disposable {
519516
command: string[],
520517
commandArgs: string[],
521518
description: string,
522-
progressReporter?: ProgressReporter,
523-
onLine?: OnLineCallback,
519+
{
520+
progressReporter,
521+
onLine,
522+
}: {
523+
progressReporter?: ProgressReporter;
524+
onLine?: OnLineCallback;
525+
} = {},
524526
): Promise<string> {
525527
if (progressReporter) {
526528
progressReporter.report({ message: description });
@@ -579,13 +581,10 @@ export class CodeQLCliServer implements Disposable {
579581
// Add format argument first, in case commandArgs contains positional parameters.
580582
args = args.concat(["--format", "json"]);
581583
args = args.concat(commandArgs);
582-
const result = await this.runCodeQlCliCommand(
583-
command,
584-
args,
585-
description,
584+
const result = await this.runCodeQlCliCommand(command, args, description, {
586585
progressReporter,
587586
onLine,
588-
);
587+
});
589588
try {
590589
return JSON.parse(result) as OutputType;
591590
} catch (err) {
@@ -757,7 +756,13 @@ export class CodeQLCliServer implements Disposable {
757756
public async *runTests(
758757
testPaths: string[],
759758
workspaces: string[],
760-
options: TestRunOptions,
759+
{
760+
cancellationToken,
761+
logger,
762+
}: {
763+
cancellationToken?: CancellationToken;
764+
logger?: Logger;
765+
},
761766
): AsyncGenerator<TestCompleted, void, unknown> {
762767
const subcommandArgs = this.cliConfig.additionalTestArguments.concat([
763768
...this.getAdditionalPacksArg(workspaces),
@@ -770,8 +775,10 @@ export class CodeQLCliServer implements Disposable {
770775
["test", "run"],
771776
subcommandArgs,
772777
"Run CodeQL Tests",
773-
options.cancellationToken,
774-
options.logger,
778+
{
779+
cancellationToken,
780+
logger,
781+
},
775782
)) {
776783
yield event;
777784
}

0 commit comments

Comments
 (0)