Skip to content

Commit f69a6c5

Browse files
More unnecessary awaits
1 parent 950a218 commit f69a6c5

File tree

7 files changed

+19
-23
lines changed

7 files changed

+19
-23
lines changed

extensions/ql-vscode/scripts/lint-scenarios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function lintScenarios() {
2828
throw new Error(`Invalid schema: ${ajv.errorsText()}`);
2929
}
3030

31-
const validate = await ajv.compile(schema);
31+
const validate = ajv.compile(schema);
3232

3333
let invalidFiles = 0;
3434

extensions/ql-vscode/src/cli.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export class CodeQLCliServer implements Disposable {
295295
);
296296
}
297297

298-
return await spawnServer(
298+
return spawnServer(
299299
codeQlPath,
300300
"CodeQL CLI Server",
301301
["execute", "cli-server"],
@@ -455,7 +455,7 @@ export class CodeQLCliServer implements Disposable {
455455
void logStream(child.stderr!, logger);
456456
}
457457

458-
for await (const event of await splitStreamAtSeparators(child.stdout!, [
458+
for await (const event of splitStreamAtSeparators(child.stdout!, [
459459
"\0",
460460
])) {
461461
yield event;
@@ -487,7 +487,7 @@ export class CodeQLCliServer implements Disposable {
487487
cancellationToken?: CancellationToken,
488488
logger?: Logger,
489489
): AsyncGenerator<EventType, void, unknown> {
490-
for await (const event of await this.runAsyncCodeQlCliCommandInternal(
490+
for await (const event of this.runAsyncCodeQlCliCommandInternal(
491491
command,
492492
commandArgs,
493493
cancellationToken,
@@ -750,7 +750,7 @@ export class CodeQLCliServer implements Disposable {
750750
...testPaths,
751751
]);
752752

753-
for await (const event of await this.runAsyncCodeQlCliCommand<TestCompleted>(
753+
for await (const event of this.runAsyncCodeQlCliCommand<TestCompleted>(
754754
["test", "run"],
755755
subcommandArgs,
756756
"Run CodeQL Tests",
@@ -1543,7 +1543,7 @@ const lineEndings = ["\r\n", "\r", "\n"];
15431543
* @param logger The logger that will consume the stream output.
15441544
*/
15451545
async function logStream(stream: Readable, logger: Logger): Promise<void> {
1546-
for await (const line of await splitStreamAtSeparators(stream, lineEndings)) {
1546+
for await (const line of splitStreamAtSeparators(stream, lineEndings)) {
15471547
// Await the result of log here in order to ensure the logs are written in the correct order.
15481548
await logger.log(line);
15491549
}

extensions/ql-vscode/src/mocks/mock-gh-api-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ export class MockGitHubApiServer extends DisposableObject {
9696
}
9797

9898
public async stopRecording(): Promise<void> {
99-
await this.recorder.stop();
100-
await this.recorder.clear();
99+
this.recorder.stop();
100+
this.recorder.clear();
101101
}
102102

103103
public async getScenarioNames(scenariosPath?: string): Promise<string[]> {

extensions/ql-vscode/src/mocks/vscode-mock-gh-api-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ export class VSCodeMockGitHubApiServer extends DisposableObject {
3535
}
3636

3737
public async startServer(): Promise<void> {
38-
await this.server.startServer();
38+
this.server.startServer();
3939
}
4040

4141
public async stopServer(): Promise<void> {
42-
await this.server.stopServer();
42+
this.server.stopServer();
4343

4444
await commands.executeCommand(
4545
"setContext",

extensions/ql-vscode/src/test-adapter.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,11 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
356356
tests: string[],
357357
cancellationToken: CancellationToken,
358358
): Promise<void> {
359-
const workspacePaths = await getOnDiskWorkspaceFolders();
360-
for await (const event of await this.cliServer.runTests(
361-
tests,
362-
workspacePaths,
363-
{
364-
cancellationToken,
365-
logger: testLogger,
366-
},
367-
)) {
359+
const workspacePaths = getOnDiskWorkspaceFolders();
360+
for await (const event of this.cliServer.runTests(tests, workspacePaths, {
361+
cancellationToken,
362+
logger: testLogger,
363+
})) {
368364
const state = event.pass
369365
? "passed"
370366
: event.messages?.length

extensions/ql-vscode/test/vscode-tests/cli-integration/legacy-query.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class Checkpoint<T> {
5050
}
5151

5252
async resolve(): Promise<void> {
53-
await this.res();
53+
this.res();
5454
}
5555

5656
async reject(e: Error): Promise<void> {
57-
await this.rej(e);
57+
this.rej(e);
5858
}
5959
}
6060

extensions/ql-vscode/test/vscode-tests/cli-integration/new-query.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class Checkpoint<T> {
5050
}
5151

5252
async resolve(): Promise<void> {
53-
await this.res();
53+
this.res();
5454
}
5555

5656
async reject(e: Error): Promise<void> {
57-
await this.rej(e);
57+
this.rej(e);
5858
}
5959
}
6060

0 commit comments

Comments
 (0)