Skip to content

Commit 467d43c

Browse files
committed
Implement refactor merge comments
1 parent f332e61 commit 467d43c

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

extensions/ql-vscode/src/common/github-url-identifier-helper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { OWNER_REGEX, REPO_REGEX } from "../pure/helpers-pure";
55
* @param identifier The GitHub NWO
66
* @returns
77
*/
8-
export function validGitHubNwo(identifier: string): boolean {
8+
export function isValidGitHubNwo(identifier: string): boolean {
99
return validGitHubNwoOrOwner(identifier, "nwo");
1010
}
1111

@@ -14,7 +14,7 @@ export function validGitHubNwo(identifier: string): boolean {
1414
* @param identifier The GitHub owner
1515
* @returns
1616
*/
17-
export function validGitHubOwner(identifier: string): boolean {
17+
export function isValidGitHubOwner(identifier: string): boolean {
1818
return validGitHubNwoOrOwner(identifier, "owner");
1919
}
2020

@@ -28,7 +28,7 @@ function validGitHubNwoOrOwner(
2828
}
2929

3030
/**
31-
* Extracts an NOW from a GitHub URL.
31+
* Extracts an NWO from a GitHub URL.
3232
* @param githubUrl The GitHub repository URL
3333
* @return The corresponding NWO, or undefined if the URL is not valid
3434
*/

extensions/ql-vscode/src/databaseFetcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Credentials } from "./authentication";
2424
import { getErrorMessage } from "./pure/helpers-pure";
2525
import {
2626
getNwoFromGitHubUrl,
27-
validGitHubNwo,
27+
isValidGitHubNwo,
2828
} from "./common/github-url-identifier-helper";
2929

3030
/**
@@ -101,7 +101,7 @@ export async function promptImportGithubDatabase(
101101
}
102102

103103
const nwo = getNwoFromGitHubUrl(githubRepo) || githubRepo;
104-
if (!validGitHubNwo(nwo)) {
104+
if (!isValidGitHubNwo(nwo)) {
105105
throw new Error(`Invalid GitHub repository: ${githubRepo}`);
106106
}
107107

extensions/ql-vscode/src/databases/ui/db-panel.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
import { commandRunner, UserCancellationException } from "../../commandRunner";
88
import {
99
getNwoFromGitHubUrl,
10-
validGitHubNwo,
10+
isValidGitHubNwo,
1111
getOwnerFromGitHubUrl,
12-
validGitHubOwner,
12+
isValidGitHubOwner,
1313
} from "../../common/github-url-identifier-helper";
1414
import { showAndLogErrorMessage } from "../../helpers";
1515
import { DisposableObject } from "../../pure/disposable-object";
@@ -123,7 +123,7 @@ export class DbPanel extends DisposableObject {
123123
}
124124

125125
const nwo = getNwoFromGitHubUrl(repoName) || repoName;
126-
if (!validGitHubNwo(nwo)) {
126+
if (!isValidGitHubNwo(nwo)) {
127127
throw new Error(`Invalid GitHub repository: ${repoName}`);
128128
}
129129

@@ -142,7 +142,7 @@ export class DbPanel extends DisposableObject {
142142
}
143143

144144
const owner = getOwnerFromGitHubUrl(ownerName) || ownerName;
145-
if (!validGitHubOwner(owner)) {
145+
if (!isValidGitHubOwner(owner)) {
146146
throw new Error(`Invalid user or organization: ${owner}`);
147147
}
148148

extensions/ql-vscode/test/pure-tests/common/github-url-identifier-helper.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import {
22
getNwoFromGitHubUrl,
33
getOwnerFromGitHubUrl,
4-
validGitHubNwo,
5-
validGitHubOwner,
4+
isValidGitHubNwo,
5+
isValidGitHubOwner,
66
} from "../../../src/common/github-url-identifier-helper";
77

88
describe("github url identifier helper", () => {
99
describe("valid GitHub Nwo Or Owner method", () => {
1010
it("should return true for valid owner", () => {
11-
expect(validGitHubOwner("github")).toBe(true);
11+
expect(isValidGitHubOwner("github")).toBe(true);
1212
});
1313
it("should return true for valid NWO", () => {
14-
expect(validGitHubNwo("github/codeql")).toBe(true);
14+
expect(isValidGitHubNwo("github/codeql")).toBe(true);
1515
});
1616
it("should return false for invalid owner", () => {
17-
expect(validGitHubOwner("github/codeql")).toBe(false);
17+
expect(isValidGitHubOwner("github/codeql")).toBe(false);
1818
});
1919
it("should return false for invalid NWO", () => {
20-
expect(validGitHubNwo("githubl")).toBe(false);
20+
expect(isValidGitHubNwo("githubl")).toBe(false);
2121
});
2222
});
2323

0 commit comments

Comments
 (0)