Skip to content

Commit 189a132

Browse files
authored
Merge pull request github#2428 from github/koesie10/unsupported-cli-version-check
Add warning when using unsupported CLI version
2 parents 4ea1bb5 + e91e9d2 commit 189a132

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

extensions/ql-vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Fix bug to ensure error messages have complete stack trace in message logs. [#2425](https://github.com/github/vscode-codeql/pull/2425)
77
- Fix bug where the `CodeQL: Compare Query` command did not work for comparing quick-eval queries. [#2422](https://github.com/github/vscode-codeql/pull/2422)
88
- Update text of copy and export buttons in variant analysis results view to clarify that they only copy/export the selected/filtered results. [#2427](https://github.com/github/vscode-codeql/pull/2427)
9+
- Add warning when using unsupported CodeQL CLI version. [#2428](https://github.com/github/vscode-codeql/pull/2428)
910

1011
## 1.8.4 - 3 May 2023
1112

extensions/ql-vscode/src/codeql-cli/cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,10 @@ export function shouldDebugCliServer() {
17371737
}
17381738

17391739
export class CliVersionConstraint {
1740+
// The oldest version of the CLI that we support. This is used to determine
1741+
// whether to show a warning about the CLI being too old on startup.
1742+
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.7.6");
1743+
17401744
/**
17411745
* CLI version where building QLX packs for remote queries is supported.
17421746
* (The options were _accepted_ by a few earlier versions, but only from

extensions/ql-vscode/src/extension.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
activate as archiveFilesystemProvider_activate,
2525
zipArchiveScheme,
2626
} from "./common/vscode/archive-filesystem-provider";
27-
import { CodeQLCliServer } from "./codeql-cli/cli";
27+
import { CliVersionConstraint, CodeQLCliServer } from "./codeql-cli/cli";
2828
import {
2929
CliConfigListener,
3030
DistributionConfigListener,
@@ -408,6 +408,28 @@ export async function activate(
408408
codeQlExtension.cliServer.addVersionChangedListener((ver) => {
409409
telemetryListener.cliVersion = ver;
410410
});
411+
412+
let unsupportedWarningShown = false;
413+
codeQlExtension.cliServer.addVersionChangedListener((ver) => {
414+
if (!ver) {
415+
return;
416+
}
417+
418+
if (unsupportedWarningShown) {
419+
return;
420+
}
421+
422+
if (CliVersionConstraint.OLDEST_SUPPORTED_CLI_VERSION.compare(ver) < 0) {
423+
return;
424+
}
425+
426+
void showAndLogWarningMessage(
427+
`You are using an unsupported version of the CodeQL CLI (${ver}). ` +
428+
`The minimum supported version is ${CliVersionConstraint.OLDEST_SUPPORTED_CLI_VERSION}. ` +
429+
`Please upgrade to a newer version of the CodeQL CLI.`,
430+
);
431+
unsupportedWarningShown = true;
432+
});
411433
}
412434

413435
return codeQlExtension;

0 commit comments

Comments
 (0)