Skip to content

Commit 0d390aa

Browse files
authored
Merge pull request #2468 from github/koesie10/remove-ignore-source-archive-option
Remove `ignoreSourceArchive` option from databases
2 parents 610a349 + f115412 commit 0d390aa

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

extensions/ql-vscode/src/databases/local-databases/database-item-impl.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import * as cli from "../../codeql-cli/cli";
33
import vscode from "vscode";
44
import { FullDatabaseOptions } from "./database-options";
5-
import { basename, dirname, join, relative } from "path";
5+
import { basename, dirname, extname, join, relative } from "path";
66
import {
77
decodeSourceArchiveUri,
88
encodeArchiveBasePath,
@@ -45,13 +45,18 @@ export class DatabaseItemImpl implements DatabaseItem {
4545
}
4646

4747
public get sourceArchive(): vscode.Uri | undefined {
48-
if (this.options.ignoreSourceArchive || this.contents === undefined) {
48+
if (this.ignoreSourceArchive || this.contents === undefined) {
4949
return undefined;
5050
} else {
5151
return this.contents.sourceArchiveUri;
5252
}
5353
}
5454

55+
private get ignoreSourceArchive(): boolean {
56+
// Ignore the source archive for QLTest databases.
57+
return extname(this.databaseUri.fsPath) === ".testproj";
58+
}
59+
5560
public get dateAdded(): number | undefined {
5661
return this.options.dateAdded;
5762
}

extensions/ql-vscode/src/databases/local-databases/database-manager.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
isCodespacesTemplate,
1111
setAutogenerateQlPacks,
1212
} from "../../config";
13-
import { extname, join } from "path";
13+
import { join } from "path";
1414
import { FullDatabaseOptions } from "./database-options";
1515
import { DatabaseItemImpl } from "./database-item-impl";
1616
import {
@@ -164,10 +164,7 @@ export class DatabaseManager extends DisposableObject {
164164
displayName: string | undefined,
165165
): Promise<DatabaseItemImpl> {
166166
const contents = await DatabaseResolver.resolveDatabaseContents(uri);
167-
// Ignore the source archive for QLTest databases by default.
168-
const isQLTestDatabase = extname(uri.fsPath) === ".testproj";
169167
const fullOptions: FullDatabaseOptions = {
170-
ignoreSourceArchive: isQLTestDatabase,
171168
// If a displayName is not passed in, the basename of folder containing the database is used.
172169
displayName,
173170
dateAdded: Date.now(),
@@ -331,16 +328,12 @@ export class DatabaseManager extends DisposableObject {
331328
state: PersistedDatabaseItem,
332329
): Promise<DatabaseItemImpl> {
333330
let displayName: string | undefined = undefined;
334-
let ignoreSourceArchive = false;
335331
let dateAdded = undefined;
336332
let language = undefined;
337333
if (state.options) {
338334
if (typeof state.options.displayName === "string") {
339335
displayName = state.options.displayName;
340336
}
341-
if (typeof state.options.ignoreSourceArchive === "boolean") {
342-
ignoreSourceArchive = state.options.ignoreSourceArchive;
343-
}
344337
if (typeof state.options.dateAdded === "number") {
345338
dateAdded = state.options.dateAdded;
346339
}
@@ -354,7 +347,6 @@ export class DatabaseManager extends DisposableObject {
354347
}
355348

356349
const fullOptions: FullDatabaseOptions = {
357-
ignoreSourceArchive,
358350
displayName,
359351
dateAdded,
360352
language,
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
export interface DatabaseOptions {
22
displayName?: string;
3-
ignoreSourceArchive?: boolean;
43
dateAdded?: number | undefined;
54
language?: string;
65
}
76

87
export interface FullDatabaseOptions extends DatabaseOptions {
9-
ignoreSourceArchive: boolean;
108
dateAdded: number | undefined;
119
language: string | undefined;
1210
}

extensions/ql-vscode/test/factories/databases/databases.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { DirResult } from "tmp";
1010
export function mockDbOptions(): FullDatabaseOptions {
1111
return {
1212
dateAdded: 123,
13-
ignoreSourceArchive: false,
1413
language: "",
1514
};
1615
}

extensions/ql-vscode/test/vscode-tests/minimal-workspace/local-databases.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ describe("local databases", () => {
634634

635635
const options: FullDatabaseOptions = {
636636
dateAdded: 123,
637-
ignoreSourceArchive: false,
638637
language,
639638
};
640639
mockDbItem = createMockDB(dir, options);

0 commit comments

Comments
 (0)