Merge pull request #2428 from github/koesie10/unsupported-cli-version-check

Add warning when using unsupported CLI version
This commit is contained in:
Koen Vlaswinkel
2023-05-22 12:49:52 +02:00
committed by GitHub
3 changed files with 28 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
- Fix bug to ensure error messages have complete stack trace in message logs. [#2425](https://github.com/github/vscode-codeql/pull/2425)
- 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)
- 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)
- Add warning when using unsupported CodeQL CLI version. [#2428](https://github.com/github/vscode-codeql/pull/2428)
## 1.8.4 - 3 May 2023

View File

@@ -1737,6 +1737,10 @@ export function shouldDebugCliServer() {
}
export class CliVersionConstraint {
// The oldest version of the CLI that we support. This is used to determine
// whether to show a warning about the CLI being too old on startup.
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.7.6");
/**
* CLI version where building QLX packs for remote queries is supported.
* (The options were _accepted_ by a few earlier versions, but only from

View File

@@ -24,7 +24,7 @@ import {
activate as archiveFilesystemProvider_activate,
zipArchiveScheme,
} from "./common/vscode/archive-filesystem-provider";
import { CodeQLCliServer } from "./codeql-cli/cli";
import { CliVersionConstraint, CodeQLCliServer } from "./codeql-cli/cli";
import {
CliConfigListener,
DistributionConfigListener,
@@ -408,6 +408,28 @@ export async function activate(
codeQlExtension.cliServer.addVersionChangedListener((ver) => {
telemetryListener.cliVersion = ver;
});
let unsupportedWarningShown = false;
codeQlExtension.cliServer.addVersionChangedListener((ver) => {
if (!ver) {
return;
}
if (unsupportedWarningShown) {
return;
}
if (CliVersionConstraint.OLDEST_SUPPORTED_CLI_VERSION.compare(ver) < 0) {
return;
}
void showAndLogWarningMessage(
`You are using an unsupported version of the CodeQL CLI (${ver}). ` +
`The minimum supported version is ${CliVersionConstraint.OLDEST_SUPPORTED_CLI_VERSION}. ` +
`Please upgrade to a newer version of the CodeQL CLI.`,
);
unsupportedWarningShown = true;
});
}
return codeQlExtension;