Skip to content

Commit 4e4345f

Browse files
committed
Merge remote-tracking branch 'origin/main' into koesie10/yauzl-progress
2 parents b2df8b6 + fbaf3d1 commit 4e4345f

File tree

9 files changed

+323
-25
lines changed

9 files changed

+323
-25
lines changed
19.2 KB
Loading

docs/test-plan.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,24 @@ Note that this test requires the feature flag: `codeQL.model.flowGeneration`
185185
2. Click "Generate".
186186
- Check that rows are filled out.
187187

188+
### GitHub database download
189+
190+
#### Test case 1: Download a database
191+
192+
Open a clone of the [`github/codeql`](https://github.com/github/codeql) repository as a folder.
193+
194+
1. Wait a few seconds until the CodeQL extension is fully initialized.
195+
- Check that the following prompt appears:
196+
197+
![database-download-prompt](images/github-database-download-prompt.png)
198+
199+
- If the prompt does not appear, ensure that the `codeQL.githubDatabase.download` setting is not set in workspace or user settings.
200+
201+
2. Click "Download".
202+
3. Select the "C#" and "JavaScript" databases.
203+
- Check that there are separate notifications for both downloads.
204+
- Check that both databases are added when the downloads are complete.
205+
188206
### General
189207

190208
#### Test case 1: Change to a different colour theme

extensions/ql-vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Add a prompt for downloading a GitHub database when opening a GitHub repository. [#3138](https://github.com/github/vscode-codeql/pull/3138)
66
- Avoid showing a popup when hovering over source elements in database source files. [#3125](https://github.com/github/vscode-codeql/pull/3125)
77
- Add comparison of alerts when comparing query results. This allows viewing path explanations for differences in alerts. [#3113](https://github.com/github/vscode-codeql/pull/3113)
8+
- Fix a bug where the CodeQL CLI and variant analysis results were corrupted after extraction in VS Code Insiders. [#3151](https://github.com/github/vscode-codeql/pull/3151) & [#3152](https://github.com/github/vscode-codeql/pull/3152)
89

910
## 1.11.0 - 13 December 2023
1011

extensions/ql-vscode/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,6 @@
424424
"title": "GitHub Databases",
425425
"order": 8,
426426
"properties": {
427-
"codeQL.githubDatabase.enable": {
428-
"type": "boolean",
429-
"default": false,
430-
"markdownDescription": "Enable automatic detection of GitHub databases."
431-
},
432427
"codeQL.githubDatabase.download": {
433428
"type": "string",
434429
"default": "ask",

extensions/ql-vscode/src/databases/github-databases/github-databases-module.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ import {
1212
askForGitHubDatabaseDownload,
1313
downloadDatabaseFromGitHub,
1414
} from "./download";
15-
import {
16-
GitHubDatabaseConfig,
17-
GitHubDatabaseConfigListener,
18-
} from "../../config";
15+
import { GitHubDatabaseConfig } from "../../config";
1916
import { DatabaseManager } from "../local-databases";
2017
import { CodeQLCliServer } from "../../codeql-cli/cli";
2118
import { CodeqlDatabase, listDatabases, ListDatabasesResult } from "./api";
@@ -28,30 +25,33 @@ import {
2825
import { Octokit } from "@octokit/rest";
2926

3027
export class GitHubDatabasesModule extends DisposableObject {
31-
private readonly config: GitHubDatabaseConfig;
32-
33-
private constructor(
28+
/**
29+
* This constructor is public only for testing purposes. Please use the `initialize` method
30+
* instead.
31+
*/
32+
constructor(
3433
private readonly app: App,
3534
private readonly databaseManager: DatabaseManager,
3635
private readonly databaseStoragePath: string,
3736
private readonly cliServer: CodeQLCliServer,
37+
private readonly config: GitHubDatabaseConfig,
3838
) {
3939
super();
40-
41-
this.config = this.push(new GitHubDatabaseConfigListener());
4240
}
4341

4442
public static async initialize(
4543
app: App,
4644
databaseManager: DatabaseManager,
4745
databaseStoragePath: string,
4846
cliServer: CodeQLCliServer,
47+
config: GitHubDatabaseConfig,
4948
): Promise<GitHubDatabasesModule> {
5049
const githubDatabasesModule = new GitHubDatabasesModule(
5150
app,
5251
databaseManager,
5352
databaseStoragePath,
5453
cliServer,
54+
config,
5555
);
5656
app.subscriptions.push(githubDatabasesModule);
5757

@@ -72,7 +72,10 @@ export class GitHubDatabasesModule extends DisposableObject {
7272
});
7373
}
7474

75-
private async promptGitHubRepositoryDownload(): Promise<void> {
75+
/**
76+
* This method is public only for testing purposes.
77+
*/
78+
public async promptGitHubRepositoryDownload(): Promise<void> {
7679
if (this.config.download === "never") {
7780
return;
7881
}

extensions/ql-vscode/src/extension.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { CliVersionConstraint, CodeQLCliServer } from "./codeql-cli/cli";
2828
import {
2929
CliConfigListener,
3030
DistributionConfigListener,
31+
GitHubDatabaseConfigListener,
3132
isCanary,
3233
joinOrderWarningThreshold,
3334
QueryHistoryConfigListener,
@@ -867,11 +868,14 @@ async function activateWithInstalledDistribution(
867868
),
868869
);
869870

871+
const githubDatabaseConfigListener = new GitHubDatabaseConfigListener();
872+
870873
await GitHubDatabasesModule.initialize(
871874
app,
872875
dbm,
873876
getContextStoragePath(ctx),
874877
cliServer,
878+
githubDatabaseConfigListener,
875879
);
876880

877881
void extLogger.log("Initializing query history.");

extensions/ql-vscode/src/query-testing/qltest-discovery.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ export class QLTestDiscovery extends Discovery {
3131
super("QL Test Discovery", extLogger);
3232

3333
this.push(this.watcher.onDidChange(this.handleDidChange, this));
34+
35+
// Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests.
36+
this.watcher.addWatch(
37+
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/*.{ql,qlref}"),
38+
);
39+
// need to explicitly watch for changes to directories themselves.
40+
this.watcher.addWatch(
41+
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/"),
42+
);
3443
}
3544

3645
/**
@@ -56,15 +65,6 @@ export class QLTestDiscovery extends Discovery {
5665
protected async discover() {
5766
this._testDirectory = await this.discoverTests();
5867

59-
this.watcher.clear();
60-
// Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests.
61-
this.watcher.addWatch(
62-
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/*.{ql,qlref}"),
63-
);
64-
// need to explicitly watch for changes to directories themselves.
65-
this.watcher.addWatch(
66-
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/"),
67-
);
6868
this._onDidChangeTests.fire(undefined);
6969
}
7070

extensions/ql-vscode/supported_cli_versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
2-
"v2.15.4",
2+
"v2.15.5",
33
"v2.14.6",
44
"v2.13.5",
55
"v2.12.7",

0 commit comments

Comments
 (0)