Skip to content

Commit e2379bb

Browse files
committed
Merge branch 'main' into aeisenberg/telemetry
2 parents 391c386 + f741deb commit e2379bb

File tree

17 files changed

+75
-26
lines changed

17 files changed

+75
-26
lines changed

.vscode/launch.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
9090
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index",
9191
"${workspaceRoot}/extensions/ql-vscode/src/vscode-tests/cli-integration/data",
92+
// Add a path to a checked out instance of the codeql repository so the libraries are
93+
// available in the workspace for the tests.
94+
// "${workspaceRoot}/../codeql"
9295
],
9396
"stopOnEntry": false,
9497
"sourceMaps": true,

.github/TELEMETRY.md renamed to TELEMETRY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ GitHub collects anonymized information related to the usage of the extensions. T
1717

1818
## How long will data be retained?
1919

20-
Data will be retained for a maximum of 30 days.
20+
IP address and GUIDs will be retained for a maximum of 30 days. Aggregated data of command identifiers and run times will be retained for a maximum of 180 days.
2121

2222
## Who will have access to this data?
2323

24-
IP address and GUIDs will be available to the core developers of CodeQL. Aggregated data will be available to GitHub employees.
24+
IP address and GUIDs will only be available to the core developers of CodeQL. Aggregated data will be available to GitHub employees.
2525

2626
## What data is **NOT** collected?
2727

extensions/ql-vscode/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## [UNRELEASED]
44

5+
## 1.3.10 - 20 January 2021
6+
7+
- Include the full stack in error log messages to help with debugging. [#726](https://github.com/github/vscode-codeql/pull/726)
8+
9+
## 1.3.9 - 12 January 2021
10+
11+
- No changes visible to end users.
12+
513
## 1.3.8 - 17 December 2020
614

715
- Ensure databases are unlocked when removing them from the workspace. This will ensure that after a database is removed from VS Code, queries can be run on it from the command line without restarting the IDE. Requires CodeQL CLI 2.4.1 or later. [#681](https://github.com/github/vscode-codeql/pull/681)

extensions/ql-vscode/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "CodeQL for Visual Studio Code",
55
"author": "GitHub",
66
"private": true,
7-
"version": "1.3.9",
7+
"version": "1.3.11",
88
"publisher": "GitHub",
99
"license": "MIT",
1010
"icon": "media/VS-marketplace-CodeQL-icon.png",
@@ -708,15 +708,15 @@
708708
"viewsWelcome": [
709709
{
710710
"view": "codeQLAstViewer",
711-
"contents": "Run the 'CodeQL: View AST' command on an open source file from a Code QL database.\n[View AST](command:codeQL.viewAst)"
711+
"contents": "Run the 'CodeQL: View AST' command on an open source file from a CodeQL database.\n[View AST](command:codeQL.viewAst)"
712712
},
713713
{
714714
"view": "codeQLQueryHistory",
715715
"contents": "Run the 'CodeQL: Run Query' command on a QL query.\n[Run Query](command:codeQL.runQuery)"
716716
},
717717
{
718718
"view": "codeQLDatabases",
719-
"contents": "Add a Code QL database:\n[From a folder](command:codeQLDatabases.chooseDatabaseFolder)\n[From an archive](command:codeQLDatabases.chooseDatabaseArchive)\n[From a URL (as a zip file)](command:codeQLDatabases.chooseDatabaseInternet)\n[From LGTM](command:codeQLDatabases.chooseDatabaseLgtm)"
719+
"contents": "Add a CodeQL database:\n[From a folder](command:codeQLDatabases.chooseDatabaseFolder)\n[From an archive](command:codeQLDatabases.chooseDatabaseArchive)\n[From a URL (as a zip file)](command:codeQLDatabases.chooseDatabaseInternet)\n[From LGTM](command:codeQLDatabases.chooseDatabaseLgtm)"
720720
}
721721
]
722722
},

extensions/ql-vscode/src/cli.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { promisify } from 'util';
1212
import { CancellationToken, Disposable } from 'vscode';
1313

1414
import { BQRSInfo, DecodedBqrsChunk } from './pure/bqrs-cli-types';
15+
import * as config from './config';
1516
import { CliConfig } from './config';
1617
import { DistributionProvider, FindDistributionResultKind } from './distribution';
1718
import { assertNever } from './pure/helpers-pure';
@@ -267,7 +268,7 @@ export class CodeQLCliServer implements Disposable {
267268
const argsString = args.join(' ');
268269
this.logger.log(`${description} using CodeQL CLI: ${argsString}...`);
269270
try {
270-
await new Promise((resolve, reject) => {
271+
await new Promise<void>((resolve, reject) => {
271272
// Start listening to stdout
272273
process.stdout.addListener('data', (newData: Buffer) => {
273274
stdoutBuffers.push(newData);
@@ -573,7 +574,7 @@ export class CodeQLCliServer implements Disposable {
573574
return await this.runJsonCodeQlCliCommand<DecodedBqrsChunk>(['bqrs', 'decode'], subcommandArgs, 'Reading bqrs data');
574575
}
575576

576-
async interpretBqrs(metadata: { kind: string; id: string }, resultsPath: string, interpretedResultsPath: string, sourceInfo?: SourceInfo): Promise<sarif.Log> {
577+
async interpretBqrs(metadata: { kind: string; id: string; scored?: string }, resultsPath: string, interpretedResultsPath: string, sourceInfo?: SourceInfo): Promise<sarif.Log> {
577578
const args = [
578579
`-t=kind=${metadata.kind}`,
579580
`-t=id=${metadata.id}`,
@@ -585,6 +586,9 @@ export class CodeQLCliServer implements Disposable {
585586
// grouping client-side.
586587
'--no-group-results',
587588
];
589+
if (config.isCanary() && metadata.scored !== undefined) {
590+
args.push(`-t=scored=${metadata.scored}`);
591+
}
588592
if (sourceInfo !== undefined) {
589593
args.push(
590594
'--source-archive', sourceInfo.sourceArchive,

extensions/ql-vscode/src/commandRunner.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ export function commandRunner(
131131
showAndLogWarningMessage(errorMessage);
132132
}
133133
} else {
134-
showAndLogErrorMessage(errorMessage);
134+
// Include the full stack in the error log only.
135+
const fullMessage = e.stack
136+
? `${errorMessage}\n${e.stack}`
137+
: errorMessage;
138+
showAndLogErrorMessage(errorMessage, {
139+
fullMessage
140+
});
135141
}
136142
return undefined;
137143
} finally {
@@ -176,7 +182,13 @@ export function commandRunnerWithProgress<R>(
176182
showAndLogWarningMessage(errorMessage);
177183
}
178184
} else {
179-
showAndLogErrorMessage(errorMessage);
185+
// Include the full stack in the error log only.
186+
const fullMessage = e.stack
187+
? `${errorMessage}\n${e.stack}`
188+
: errorMessage;
189+
showAndLogErrorMessage(errorMessage, {
190+
fullMessage
191+
});
180192
}
181193
return undefined;
182194
} finally {

extensions/ql-vscode/src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,7 @@ export class CliConfigListener extends ConfigListener implements CliConfig {
253253
* Enables canary features of this extension. Recommended for all internal users.
254254
*/
255255
export const CANARY_FEATURES = new Setting('canary', ROOT_SETTING);
256+
257+
export function isCanary() {
258+
return !!CANARY_FEATURES.getValue<boolean>();
259+
}

extensions/ql-vscode/src/helpers.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ import { logger } from './logging';
1616
* @param message The message to show.
1717
* @param options.outputLogger The output logger that will receive the message
1818
* @param options.items A set of items that will be rendered as actions in the message.
19+
* @param options.fullMessage An alternate message that is added to the log, but not displayed
20+
* in the popup. This is useful for adding extra detail to the logs
21+
* that would be too noisy for the popup.
1922
*
2023
* @return A promise that resolves to the selected item or undefined when being dismissed.
2124
*/
2225
export async function showAndLogErrorMessage(message: string, {
2326
outputLogger = logger,
24-
items = [] as string[]
27+
items = [] as string[],
28+
fullMessage = undefined as (string | undefined)
2529
} = {}): Promise<string | undefined> {
26-
return internalShowAndLog(message, items, outputLogger, Window.showErrorMessage);
30+
return internalShowAndLog(message, items, outputLogger, Window.showErrorMessage, fullMessage);
2731
}
2832
/**
2933
* Show a warning message and log it to the console
@@ -58,10 +62,15 @@ export async function showAndLogInformationMessage(message: string, {
5862

5963
type ShowMessageFn = (message: string, ...items: string[]) => Thenable<string | undefined>;
6064

61-
async function internalShowAndLog(message: string, items: string[], outputLogger = logger,
62-
fn: ShowMessageFn): Promise<string | undefined> {
65+
async function internalShowAndLog(
66+
message: string,
67+
items: string[],
68+
outputLogger = logger,
69+
fn: ShowMessageFn,
70+
fullMessage?: string
71+
): Promise<string | undefined> {
6372
const label = 'Show Log';
64-
outputLogger.log(message);
73+
outputLogger.log(fullMessage || message);
6574
const result = await fn(message, label, ...items);
6675
if (result === label) {
6776
outputLogger.show();

extensions/ql-vscode/src/pure/interface-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface QueryMetadata {
3434
description?: string;
3535
id?: string;
3636
kind?: string;
37+
scored?: string;
3738
}
3839

3940
export interface PreviousExecution {

0 commit comments

Comments
 (0)