Skip to content

Commit 4cb3c4c

Browse files
authored
Merge pull request #1968 from github/nora/rename-db-config-file
Rename DbConfigFile and Schema
2 parents 856e516 + 6f78fff commit 4cb3c4c

12 files changed

Lines changed: 51 additions & 21 deletions

File tree

File renamed without changes.

extensions/ql-vscode/gulpfile.ts/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const packageFiles = [
2323
"snippets.json",
2424
"media",
2525
"out",
26-
"workspace-databases-schema.json",
26+
"databases-schema.json",
2727
];
2828

2929
async function copyDirectory(

extensions/ql-vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
},
9393
"jsonValidation": [
9494
{
95-
"fileMatch": "workspace-databases.json",
96-
"url": "./workspace-databases-schema.json"
95+
"fileMatch": "GitHub.vscode-codeql/databases.json",
96+
"url": "./databases-schema.json"
9797
}
9898
],
9999
"languages": [

extensions/ql-vscode/src/databases/config/db-config-store.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
} from "../db-item";
3333

3434
export class DbConfigStore extends DisposableObject {
35+
public static readonly databaseConfigFileName = "databases.json";
36+
3537
public readonly onDidChangeConfig: AppEvent<void>;
3638
private readonly onDidChangeConfigEventEmitter: AppEventEmitter<void>;
3739

@@ -49,7 +51,7 @@ export class DbConfigStore extends DisposableObject {
4951
super();
5052

5153
const storagePath = app.workspaceStoragePath || app.globalStoragePath;
52-
this.configPath = join(storagePath, "workspace-databases.json");
54+
this.configPath = join(storagePath, DbConfigStore.databaseConfigFileName);
5355

5456
this.config = this.createEmptyConfig();
5557
this.configErrors = [];

extensions/ql-vscode/src/databases/config/db-config-validator.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ export class DbConfigValidator {
1212
private readonly schema: any;
1313

1414
constructor(extensionPath: string) {
15-
const schemaPath = resolve(
16-
extensionPath,
17-
"workspace-databases-schema.json",
18-
);
15+
const schemaPath = resolve(extensionPath, "databases-schema.json");
1916
this.schema = readJsonSync(schemaPath);
2017
}
2118

extensions/ql-vscode/test/unit-tests/databases/config/data/workspace-databases.json renamed to extensions/ql-vscode/test/unit-tests/databases/config/data/databases.json

File renamed without changes.

extensions/ql-vscode/test/unit-tests/databases/config/data/invalid/workspace-databases.json renamed to extensions/ql-vscode/test/unit-tests/databases/config/data/invalid/databases.json

File renamed without changes.

extensions/ql-vscode/test/unit-tests/databases/config/data/without-selected/workspace-databases.json renamed to extensions/ql-vscode/test/unit-tests/databases/config/data/without-selected/databases.json

File renamed without changes.

extensions/ql-vscode/test/unit-tests/databases/config/db-config-store.test.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe("db config store", () => {
4242

4343
const configPath = join(
4444
tempWorkspaceStoragePath,
45-
"workspace-databases.json",
45+
DbConfigStore.databaseConfigFileName,
4646
);
4747

4848
const configStore = new DbConfigStore(app, false);
@@ -195,7 +195,10 @@ describe("db config store", () => {
195195
workspaceStoragePath: tempWorkspaceStoragePath,
196196
});
197197

198-
configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
198+
configPath = join(
199+
tempWorkspaceStoragePath,
200+
DbConfigStore.databaseConfigFileName,
201+
);
199202
});
200203

201204
it("should add a remote repository", async () => {
@@ -320,7 +323,10 @@ describe("db config store", () => {
320323
workspaceStoragePath: tempWorkspaceStoragePath,
321324
});
322325

323-
configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
326+
configPath = join(
327+
tempWorkspaceStoragePath,
328+
DbConfigStore.databaseConfigFileName,
329+
);
324330
});
325331

326332
it("should allow renaming a remote list", async () => {
@@ -492,7 +498,10 @@ describe("db config store", () => {
492498
workspaceStoragePath: tempWorkspaceStoragePath,
493499
});
494500

495-
configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
501+
configPath = join(
502+
tempWorkspaceStoragePath,
503+
DbConfigStore.databaseConfigFileName,
504+
);
496505
});
497506

498507
it("should remove a single db item", async () => {
@@ -612,7 +621,10 @@ describe("db config store", () => {
612621
workspaceStoragePath: tempWorkspaceStoragePath,
613622
});
614623

615-
configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
624+
configPath = join(
625+
tempWorkspaceStoragePath,
626+
DbConfigStore.databaseConfigFileName,
627+
);
616628
});
617629

618630
it("should set the selected item", async () => {
@@ -648,7 +660,10 @@ describe("db config store", () => {
648660
workspaceStoragePath: tempWorkspaceStoragePath,
649661
});
650662

651-
configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
663+
configPath = join(
664+
tempWorkspaceStoragePath,
665+
DbConfigStore.databaseConfigFileName,
666+
);
652667
});
653668

654669
it("should return true if a remote owner exists", async () => {

extensions/ql-vscode/test/unit-tests/databases/db-manager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe("db manager", () => {
5050

5151
dbConfigFilePath = join(
5252
tempWorkspaceStoragePath,
53-
"workspace-databases.json",
53+
DbConfigStore.databaseConfigFileName,
5454
);
5555
});
5656

0 commit comments

Comments
 (0)