Skip to content

Commit abc025c

Browse files
Inline the createOctokit method
It's now only used from one place and inlining it doesn't make getOctokit too long to be unclear.
1 parent 551f76c commit abc025c

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

extensions/ql-vscode/src/authentication.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ export class Credentials {
4747
return new Credentials(new Octokit.Octokit({ auth: overrideToken, retry }));
4848
}
4949

50-
private async createOctokit(): Promise<Octokit.Octokit> {
50+
/**
51+
* Creates or returns an instance of Octokit.
52+
*
53+
* @returns An instance of Octokit.
54+
*/
55+
async getOctokit(): Promise<Octokit.Octokit> {
56+
if (this.octokit) {
57+
return this.octokit;
58+
}
59+
5160
const session = await vscode.authentication.getSession(
5261
GITHUB_AUTH_PROVIDER_ID,
5362
SCOPES,
@@ -59,16 +68,4 @@ export class Credentials {
5968
retry,
6069
});
6170
}
62-
63-
/**
64-
* Creates or returns an instance of Octokit.
65-
*
66-
* @returns An instance of Octokit.
67-
*/
68-
async getOctokit(): Promise<Octokit.Octokit> {
69-
if (this.octokit) {
70-
return this.octokit;
71-
}
72-
return await this.createOctokit();
73-
}
7471
}

0 commit comments

Comments
 (0)