Merge branch 'main' into robertbrignull/logged_error_telemetry
This commit is contained in:
@@ -49,7 +49,6 @@ const baseConfig = {
|
||||
"@typescript-eslint/no-throw-literal": "error",
|
||||
"no-useless-escape": 0,
|
||||
camelcase: "off",
|
||||
eqeqeq: "off",
|
||||
"escompat/no-regexp-lookbehind": "off",
|
||||
"etc/no-implicit-any-catch": "error",
|
||||
"filenames/match-regex": "off",
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
## [UNRELEASED]
|
||||
|
||||
- Renamed command "CodeQL: Run Query" to "CodeQL: Run Query on Selected Dababase".
|
||||
## 1.7.8 - 2 February 2023
|
||||
|
||||
- Renamed command "CodeQL: Run Query" to "CodeQL: Run Query on Selected Database". [#1962](https://github.com/github/vscode-codeql/pull/1962)
|
||||
- Remove support for CodeQL CLI versions older than 2.7.6. [#1788](https://github.com/github/vscode-codeql/pull/1788)
|
||||
|
||||
## 1.7.7 - 13 December 2022
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
"$schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"databases": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -119,6 +122,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["databases"],
|
||||
"required": ["databases", "version"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
4
extensions/ql-vscode/package-lock.json
generated
4
extensions/ql-vscode/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "vscode-codeql",
|
||||
"version": "1.7.8",
|
||||
"version": "1.7.9",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "vscode-codeql",
|
||||
"version": "1.7.8",
|
||||
"version": "1.7.9",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "CodeQL for Visual Studio Code",
|
||||
"author": "GitHub",
|
||||
"private": true,
|
||||
"version": "1.7.8",
|
||||
"version": "1.7.9",
|
||||
"publisher": "GitHub",
|
||||
"license": "MIT",
|
||||
"icon": "media/VS-marketplace-CodeQL-icon.png",
|
||||
@@ -1483,7 +1483,7 @@
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "npm run format-staged",
|
||||
"pre-push": "npm run lint && scripts/forbid-test-only"
|
||||
"pre-push": "scripts/forbid-test-only"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
|
||||
@@ -51,7 +51,7 @@ export abstract class AbstractWebview<
|
||||
}
|
||||
|
||||
protected async getPanel(): Promise<WebviewPanel> {
|
||||
if (this.panel == undefined) {
|
||||
if (this.panel === undefined) {
|
||||
const { ctx } = this;
|
||||
|
||||
// This is an async method, so in theory this method can be called concurrently. To ensure that we don't
|
||||
|
||||
@@ -384,7 +384,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
this.killProcessIfRunning();
|
||||
// Report the error (if there is a stderr then use that otherwise just report the error cod or nodejs error)
|
||||
const newError =
|
||||
stderrBuffers.length == 0
|
||||
stderrBuffers.length === 0
|
||||
? new Error(`${description} failed: ${err}`)
|
||||
: new Error(
|
||||
`${description} failed: ${Buffer.concat(stderrBuffers).toString(
|
||||
|
||||
@@ -357,7 +357,7 @@ export class QueryServerConfigListener
|
||||
if (memory === null) {
|
||||
return undefined;
|
||||
}
|
||||
if (memory == 0 || typeof memory !== "number") {
|
||||
if (memory === 0 || typeof memory !== "number") {
|
||||
void extLogger.log(
|
||||
`Ignoring value '${memory}' for setting ${MEMORY_SETTING.qualifiedName}`,
|
||||
);
|
||||
@@ -647,3 +647,16 @@ export class MockGitHubApiConfigListener
|
||||
export function getMockGitHubApiServerScenariosPath(): string | undefined {
|
||||
return MOCK_GH_API_SERVER_SCENARIOS_PATH.getValue<string>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables features that are specific to the codespaces-codeql template workspace from
|
||||
* https://github.com/github/codespaces-codeql.
|
||||
*/
|
||||
export const CODESPACES_TEMPLATE = new Setting(
|
||||
"codespacesTemplate",
|
||||
ROOT_SETTING,
|
||||
);
|
||||
|
||||
export function isCodespacesTemplate() {
|
||||
return !!CODESPACES_TEMPLATE.getValue<boolean>();
|
||||
}
|
||||
|
||||
@@ -128,9 +128,9 @@ function createTemplates(path: string): Record<string, string> {
|
||||
function isValidSelect(selectInfo: ResultSetSchema | undefined) {
|
||||
return (
|
||||
selectInfo &&
|
||||
selectInfo.columns.length == 3 &&
|
||||
selectInfo.columns[0].kind == ColumnKindCode.ENTITY &&
|
||||
selectInfo.columns[1].kind == ColumnKindCode.ENTITY &&
|
||||
selectInfo.columns[2].kind == ColumnKindCode.STRING
|
||||
selectInfo.columns.length === 3 &&
|
||||
selectInfo.columns[0].kind === ColumnKindCode.ENTITY &&
|
||||
selectInfo.columns[1].kind === ColumnKindCode.ENTITY &&
|
||||
selectInfo.columns[2].kind === ColumnKindCode.STRING
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
CancellationToken,
|
||||
ThemeIcon,
|
||||
ThemeColor,
|
||||
workspace,
|
||||
} from "vscode";
|
||||
import { pathExists, stat, readdir, remove } from "fs-extra";
|
||||
|
||||
@@ -220,6 +221,15 @@ export class DatabaseUI extends DisposableObject {
|
||||
},
|
||||
),
|
||||
);
|
||||
this.push(
|
||||
commandRunnerWithProgress(
|
||||
"codeQL.setDefaultTourDatabase",
|
||||
this.handleSetDefaultTourDatabase,
|
||||
{
|
||||
title: "Set Default Database for Codespace CodeQL Tour",
|
||||
},
|
||||
),
|
||||
);
|
||||
this.push(
|
||||
commandRunnerWithProgress(
|
||||
"codeQL.upgradeCurrentDatabase",
|
||||
@@ -354,6 +364,40 @@ export class DatabaseUI extends DisposableObject {
|
||||
}
|
||||
};
|
||||
|
||||
private handleSetDefaultTourDatabase = async (
|
||||
progress: ProgressCallback,
|
||||
token: CancellationToken,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
if (!workspace.workspaceFolders?.length) {
|
||||
throw new Error("No workspace folder is open.");
|
||||
} else {
|
||||
// This specifically refers to the database folder in
|
||||
// https://github.com/github/codespaces-codeql
|
||||
const uri = Uri.parse(
|
||||
`${workspace.workspaceFolders[0].uri}/codeql-tutorial-database`,
|
||||
);
|
||||
|
||||
let databaseItem = this.databaseManager.findDatabaseItem(uri);
|
||||
if (databaseItem === undefined) {
|
||||
databaseItem = await this.databaseManager.openDatabase(
|
||||
progress,
|
||||
token,
|
||||
uri,
|
||||
);
|
||||
}
|
||||
await this.databaseManager.setCurrentDatabaseItem(databaseItem);
|
||||
}
|
||||
} catch (e) {
|
||||
// rethrow and let this be handled by default error handling.
|
||||
throw new Error(
|
||||
`Could not set the database for the Code Tour. Please make sure you are using the default workspace in your codespace: ${getErrorMessage(
|
||||
e,
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
handleRemoveOrphanedDatabases = async (): Promise<void> => {
|
||||
void extLogger.log("Removing orphaned databases from workspace storage.");
|
||||
let dbDirs = undefined;
|
||||
|
||||
@@ -906,7 +906,7 @@ export class DatabaseManager extends DisposableObject {
|
||||
token: vscode.CancellationToken,
|
||||
item: DatabaseItem,
|
||||
) {
|
||||
if (this._currentDatabaseItem == item) {
|
||||
if (this._currentDatabaseItem === item) {
|
||||
this._currentDatabaseItem = undefined;
|
||||
}
|
||||
const index = this.databaseItems.findIndex(
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
renameLocalList,
|
||||
renameRemoteList,
|
||||
SelectedDbItem,
|
||||
DB_CONFIG_VERSION,
|
||||
} from "./db-config";
|
||||
import * as chokidar from "chokidar";
|
||||
import { DisposableObject, DisposeHandler } from "../../pure/disposable-object";
|
||||
@@ -459,6 +460,7 @@ export class DbConfigStore extends DisposableObject {
|
||||
|
||||
private createEmptyConfig(): DbConfig {
|
||||
return {
|
||||
version: DB_CONFIG_VERSION,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: [],
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
// Contains models for the data we want to store in the database config
|
||||
// Contains models and consts for the data we want to store in the database config.
|
||||
// Changes to these models should be done carefully and account for backwards compatibility of data.
|
||||
|
||||
export const DB_CONFIG_VERSION = 1;
|
||||
|
||||
export interface DbConfig {
|
||||
version: number;
|
||||
databases: DbConfigDatabases;
|
||||
selected?: SelectedDbItem;
|
||||
}
|
||||
@@ -89,6 +93,7 @@ export interface LocalDatabase {
|
||||
|
||||
export function cloneDbConfig(config: DbConfig): DbConfig {
|
||||
return {
|
||||
version: config.version,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: config.databases.variantAnalysis.repositoryLists.map(
|
||||
|
||||
@@ -650,10 +650,10 @@ export class ReleasesApiConsumer {
|
||||
redirectCount < ReleasesApiConsumer._maxRedirects
|
||||
) {
|
||||
const parsedRedirectUrl = parse(redirectUrl);
|
||||
if (parsedRedirectUrl.protocol != "https:") {
|
||||
if (parsedRedirectUrl.protocol !== "https:") {
|
||||
throw new Error("Encountered a non-https redirect, rejecting");
|
||||
}
|
||||
if (parsedRedirectUrl.host != "api.github.com") {
|
||||
if (parsedRedirectUrl.host !== "api.github.com") {
|
||||
// Remove authorization header if we are redirected outside of the GitHub API.
|
||||
//
|
||||
// This is necessary to stream release assets since AWS fails if more than one auth
|
||||
|
||||
@@ -112,7 +112,7 @@ function sortInterpretedResults(
|
||||
function interpretedPageSize(
|
||||
interpretation: Interpretation | undefined,
|
||||
): number {
|
||||
if (interpretation?.data.t == "GraphInterpretationData") {
|
||||
if (interpretation?.data.t === "GraphInterpretationData") {
|
||||
// Graph views always have one result per page.
|
||||
return 1;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ function numPagesOfResultSet(
|
||||
const pageSize = interpretedPageSize(interpretation);
|
||||
|
||||
const n =
|
||||
interpretation?.data.t == "GraphInterpretationData"
|
||||
interpretation?.data.t === "GraphInterpretationData"
|
||||
? interpretation.data.dot.length
|
||||
: resultSet.schema.rows;
|
||||
|
||||
@@ -143,7 +143,7 @@ function numInterpretedPages(
|
||||
const pageSize = interpretedPageSize(interpretation);
|
||||
|
||||
const n =
|
||||
interpretation.data.t == "GraphInterpretationData"
|
||||
interpretation.data.t === "GraphInterpretationData"
|
||||
? interpretation.data.dot.length
|
||||
: interpretation.data.runs[0].results?.length || 0;
|
||||
|
||||
@@ -453,7 +453,7 @@ export class ResultsView extends AbstractWebview<
|
||||
|
||||
const selectedTable = getDefaultResultSetName(resultSetNames);
|
||||
const schema = resultSetSchemas.find(
|
||||
(resultSet) => resultSet.name == selectedTable,
|
||||
(resultSet) => resultSet.name === selectedTable,
|
||||
)!;
|
||||
|
||||
// Use sorted results path if it exists. This may happen if we are
|
||||
@@ -597,7 +597,7 @@ export class ResultsView extends AbstractWebview<
|
||||
const resultSetNames = allResultSetSchemas.map((schema) => schema.name);
|
||||
|
||||
const schema = resultSetSchemas.find(
|
||||
(resultSet) => resultSet.name == selectedTable,
|
||||
(resultSet) => resultSet.name === selectedTable,
|
||||
)!;
|
||||
if (schema === undefined)
|
||||
throw new Error(`Query result set '${selectedTable}' not found.`);
|
||||
|
||||
@@ -323,7 +323,7 @@ export async function compileAndRunQueryAgainstDatabase(
|
||||
// This test will produce confusing results if we ever change the name of the database schema files.
|
||||
const querySchemaName = basename(packConfig.dbscheme);
|
||||
const dbSchemaName = basename(dbItem.contents.dbSchemeUri.fsPath);
|
||||
if (querySchemaName != dbSchemaName) {
|
||||
if (querySchemaName !== dbSchemaName) {
|
||||
void extLogger.log(
|
||||
`Query schema was ${querySchemaName}, but database schema was ${dbSchemaName}.`,
|
||||
);
|
||||
@@ -406,7 +406,7 @@ export async function compileAndRunQueryAgainstDatabase(
|
||||
} catch (e) {
|
||||
if (
|
||||
e instanceof ResponseError &&
|
||||
e.code == LSPErrorCodes.RequestCancelled
|
||||
e.code === LSPErrorCodes.RequestCancelled
|
||||
) {
|
||||
return createSyntheticResult(query, "Query cancelled");
|
||||
} else {
|
||||
@@ -437,7 +437,7 @@ export async function compileAndRunQueryAgainstDatabase(
|
||||
query: query.queryEvalInfo,
|
||||
message,
|
||||
result,
|
||||
successful: result.resultType == messages.QueryResultType.SUCCESS,
|
||||
successful: result.resultType === messages.QueryResultType.SUCCESS,
|
||||
logFileLocation: result.logFileLocation,
|
||||
dispose: () => {
|
||||
qs.logger.removeAdditionalLogLocation(result.logFileLocation);
|
||||
|
||||
@@ -338,7 +338,7 @@ class JoinOrderScanner implements EvaluationLogScanner {
|
||||
inLayerEvent.predicateIterationMillis.length <= iteration
|
||||
? -1
|
||||
: inLayerEvent.predicateIterationMillis[iteration];
|
||||
if (iterationTime != -1) {
|
||||
if (iterationTime !== -1) {
|
||||
const run: PipelineRun =
|
||||
inLayerEvent.pipelineRuns[nextPipeline[predicate]++];
|
||||
func(inLayerEvent, run, iteration);
|
||||
|
||||
@@ -60,7 +60,7 @@ export function getPath(
|
||||
for (const codeFlows of result.codeFlows) {
|
||||
for (const threadFlow of codeFlows.threadFlows) {
|
||||
++index;
|
||||
if (index == key.pathIndex) return threadFlow;
|
||||
if (index === key.pathIndex) return threadFlow;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@@ -192,8 +192,8 @@ export function shouldHighlightLine(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (highlightedRegion.endLine == undefined) {
|
||||
return lineNumber == highlightedRegion.startLine;
|
||||
if (highlightedRegion.endLine === undefined) {
|
||||
return lineNumber === highlightedRegion.startLine;
|
||||
}
|
||||
|
||||
return lineNumber <= highlightedRegion.endLine;
|
||||
|
||||
@@ -624,7 +624,7 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
await Promise.all(
|
||||
this.treeDataProvider.allHistory.map(async (item) => {
|
||||
if (
|
||||
item.t == "local" &&
|
||||
item.t === "local" &&
|
||||
item.completedQuery &&
|
||||
!(await pathExists(item.completedQuery?.query.querySaveDir))
|
||||
) {
|
||||
@@ -841,7 +841,7 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
if (
|
||||
prevItemClick !== undefined &&
|
||||
now.valueOf() - prevItemClick.time.valueOf() < DOUBLE_CLICK_TIME &&
|
||||
finalSingleItem == prevItemClick.item
|
||||
finalSingleItem === prevItemClick.item
|
||||
) {
|
||||
// show original query file on double click
|
||||
await this.handleOpenQuery(finalSingleItem, [finalSingleItem]);
|
||||
@@ -1050,7 +1050,7 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
}
|
||||
|
||||
// If the JSON summary file location wasn't saved, display error
|
||||
if (finalSingleItem.jsonEvalLogSummaryLocation == undefined) {
|
||||
if (finalSingleItem.jsonEvalLogSummaryLocation === undefined) {
|
||||
this.warnInProgressEvalLogViewer();
|
||||
return;
|
||||
}
|
||||
@@ -1349,7 +1349,7 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
private updateTreeViewSelectionIfVisible() {
|
||||
if (this.treeView.visible) {
|
||||
const current = this.treeDataProvider.getCurrent();
|
||||
if (current != undefined) {
|
||||
if (current !== undefined) {
|
||||
// We must fire the onDidChangeTreeData event to ensure the current element can be selected
|
||||
// using `reveal` if the tree view was not visible when the current element was added.
|
||||
this.treeDataProvider.refresh();
|
||||
|
||||
@@ -149,7 +149,7 @@ export async function displayQuickQuery(
|
||||
} catch (e) {
|
||||
if (
|
||||
e instanceof ResponseError &&
|
||||
e.code == LSPErrorCodes.RequestCancelled
|
||||
e.code === LSPErrorCodes.RequestCancelled
|
||||
) {
|
||||
throw new UserCancellationException(getErrorMessage(e));
|
||||
} else {
|
||||
|
||||
@@ -153,7 +153,7 @@ export function tryGetRule(
|
||||
}
|
||||
|
||||
const ruleIndex = resultRule.index;
|
||||
if (ruleIndex != undefined) {
|
||||
if (ruleIndex !== undefined) {
|
||||
const toolComponentIndex = result.rule?.toolComponent?.index;
|
||||
const toolExtensions = sarifRun.tool.extensions;
|
||||
if (toolComponentIndex !== undefined && toolExtensions !== undefined) {
|
||||
|
||||
@@ -517,7 +517,7 @@ export async function determineSelectedQuery(
|
||||
let quickEvalPosition: messages.Position | undefined = undefined;
|
||||
let quickEvalText: string | undefined = undefined;
|
||||
if (quickEval) {
|
||||
if (editor == undefined) {
|
||||
if (editor === undefined) {
|
||||
throw new Error("Can't run quick evaluation without an active editor.");
|
||||
}
|
||||
if (editor.document.fileName !== queryPath) {
|
||||
|
||||
@@ -310,7 +310,7 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
|
||||
reopenedDatabase,
|
||||
closedDatabase.name,
|
||||
);
|
||||
if (currentDatabaseUri == uri) {
|
||||
if (currentDatabaseUri?.toString() === uri.toString()) {
|
||||
await this.databaseManager.setCurrentDatabaseItem(
|
||||
reopenedDatabase,
|
||||
true,
|
||||
|
||||
@@ -53,7 +53,7 @@ export const CodeSnippetLine = ({
|
||||
message &&
|
||||
severity &&
|
||||
highlightedRegion &&
|
||||
highlightedRegion.endLine == startingLineIndex + lineIndex;
|
||||
highlightedRegion.endLine === startingLineIndex + lineIndex;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -177,7 +177,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
||||
msg: string | undefined,
|
||||
locationHint: string,
|
||||
): JSX.Element | undefined {
|
||||
if (msg == undefined) return undefined;
|
||||
if (msg === undefined) return undefined;
|
||||
return <span title={locationHint}>{msg}</span>;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
||||
const paths: Sarif.ThreadFlow[] = Keys.getAllPaths(result);
|
||||
|
||||
const indices =
|
||||
paths.length == 1
|
||||
paths.length === 1
|
||||
? [resultKey, { ...resultKey, pathIndex: 0 }]
|
||||
: /* if there's exactly one path, auto-expand
|
||||
* the path when expanding the result */
|
||||
|
||||
@@ -80,7 +80,7 @@ export class Graph extends React.Component<GraphProps> {
|
||||
graphviz(`#${graphId}`)
|
||||
.options(options)
|
||||
.attributer(function (d) {
|
||||
if (d.tag == "a") {
|
||||
if (d.tag === "a") {
|
||||
const url = d.attributes["xlink:href"] || d.attributes["href"];
|
||||
const loc = tryGetLocationFromString(url);
|
||||
if (loc !== undefined) {
|
||||
@@ -94,13 +94,13 @@ export class Graph extends React.Component<GraphProps> {
|
||||
}
|
||||
|
||||
if ("fill" in d.attributes) {
|
||||
d.attributes.fill = d.tag == "text" ? color : backgroundColor;
|
||||
d.attributes.fill = d.tag === "text" ? color : backgroundColor;
|
||||
}
|
||||
if ("stroke" in d.attributes) {
|
||||
// There is no proper way to identify the element containing the graph (which we
|
||||
// don't want a border around), as it is just has tag 'polygon'. Instead we assume
|
||||
// that the first polygon we see is that element
|
||||
if (d.tag != "polygon" || !firstPolygon) {
|
||||
if (d.tag !== "polygon" || !firstPolygon) {
|
||||
d.attributes.stroke = borderColor;
|
||||
} else {
|
||||
firstPolygon = false;
|
||||
|
||||
@@ -92,7 +92,7 @@ export class ResultTables extends React.Component<
|
||||
// @ts-ignore 2783
|
||||
this.props.rawResultSets.map((rs) => ({ t: "RawResultSet", ...rs }));
|
||||
|
||||
if (this.props.interpretation != undefined) {
|
||||
if (this.props.interpretation !== undefined) {
|
||||
const tableName = this.getInterpretedTableName();
|
||||
resultSets.push({
|
||||
t: "InterpretedResultSet",
|
||||
@@ -307,10 +307,11 @@ export class ResultTables extends React.Component<
|
||||
const resultSetNames = this.getResultSetNames();
|
||||
|
||||
const resultSet = resultSets.find(
|
||||
(resultSet) => resultSet.schema.name == selectedTable,
|
||||
(resultSet) => resultSet.schema.name === selectedTable,
|
||||
);
|
||||
const nonemptyRawResults = resultSets.some(
|
||||
(resultSet) => resultSet.t == "RawResultSet" && resultSet.rows.length > 0,
|
||||
(resultSet) =>
|
||||
resultSet.t === "RawResultSet" && resultSet.rows.length > 0,
|
||||
);
|
||||
const numberOfResults = resultSet && renderResultCountString(resultSet);
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ export class ResultsApp extends React.Component<
|
||||
}
|
||||
sortStates={displayedResults.results.sortStates}
|
||||
interpretedSortState={
|
||||
data?.t == "SarifInterpretationData" ? data.sortState : undefined
|
||||
data?.t === "SarifInterpretationData" ? data.sortState : undefined
|
||||
}
|
||||
isLoadingNewResults={
|
||||
this.state.isExpectingResultsUpdate ||
|
||||
|
||||
@@ -130,7 +130,7 @@ const canSelect = (
|
||||
status: VariantAnalysisRepoStatus | undefined,
|
||||
downloadStatus: VariantAnalysisScannedRepositoryDownloadStatus | undefined,
|
||||
) =>
|
||||
status == VariantAnalysisRepoStatus.Succeeded &&
|
||||
status === VariantAnalysisRepoStatus.Succeeded &&
|
||||
downloadStatus === VariantAnalysisScannedRepositoryDownloadStatus.Succeeded;
|
||||
|
||||
const isExpandableContentLoaded = (
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
LocalList,
|
||||
RemoteRepositoryList,
|
||||
SelectedDbItem,
|
||||
DB_CONFIG_VERSION,
|
||||
} from "../../src/databases/config/db-config";
|
||||
|
||||
export function createDbConfig({
|
||||
@@ -23,6 +24,7 @@ export function createDbConfig({
|
||||
selected?: SelectedDbItem;
|
||||
} = {}): DbConfig {
|
||||
return {
|
||||
version: DB_CONFIG_VERSION,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: remoteLists,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"version": 1,
|
||||
"databases": {
|
||||
"variantAnalysis": {
|
||||
"repositoryLists": [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"version": 1,
|
||||
"databases": {
|
||||
"variantAnalysis": {
|
||||
"repositoryLists": [],
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { join } from "path";
|
||||
import { DbConfig } from "../../../../src/databases/config/db-config";
|
||||
import {
|
||||
DbConfig,
|
||||
DB_CONFIG_VERSION,
|
||||
} from "../../../../src/databases/config/db-config";
|
||||
import { DbConfigValidator } from "../../../../src/databases/config/db-config-validator";
|
||||
import { DbConfigValidationErrorKind } from "../../../../src/databases/db-validation-errors";
|
||||
import {
|
||||
@@ -15,6 +18,7 @@ describe("db config validation", () => {
|
||||
// We're intentionally bypassing the type check because we'd
|
||||
// like to make sure validation errors are highlighted.
|
||||
const dbConfig = {
|
||||
version: DB_CONFIG_VERSION,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: [
|
||||
|
||||
@@ -413,6 +413,7 @@ describe("db manager", () => {
|
||||
const dbConfigFileContents = await readDbConfigDirectly();
|
||||
|
||||
expect(dbConfigFileContents).toEqual({
|
||||
version: dbConfig.version,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: [],
|
||||
@@ -434,6 +435,7 @@ describe("db manager", () => {
|
||||
const dbConfigFileContents = await readDbConfigDirectly();
|
||||
|
||||
expect(dbConfigFileContents).toEqual({
|
||||
version: dbConfig.version,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: [remoteList],
|
||||
@@ -459,6 +461,7 @@ describe("db manager", () => {
|
||||
const dbConfigFileContents = await readDbConfigDirectly();
|
||||
|
||||
expect(dbConfigFileContents).toEqual({
|
||||
version: dbConfig.version,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: [remoteList],
|
||||
@@ -484,6 +487,7 @@ describe("db manager", () => {
|
||||
const dbConfigFileContents = await readDbConfigDirectly();
|
||||
|
||||
expect(dbConfigFileContents).toEqual({
|
||||
version: dbConfig.version,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: [remoteList],
|
||||
@@ -513,6 +517,7 @@ describe("db manager", () => {
|
||||
const dbConfigFileContents = await readDbConfigDirectly();
|
||||
|
||||
expect(dbConfigFileContents).toEqual({
|
||||
version: dbConfig.version,
|
||||
databases: {
|
||||
variantAnalysis: {
|
||||
repositoryLists: [remoteList],
|
||||
|
||||
@@ -15,7 +15,7 @@ jest.setTimeout(60_000);
|
||||
/**
|
||||
* Run various integration tests for databases
|
||||
*/
|
||||
describe("Databases", () => {
|
||||
describe("DatabaseFetcher", () => {
|
||||
let databaseManager: DatabaseManager;
|
||||
let inputBoxStub: jest.SpiedFunction<typeof window.showInputBox>;
|
||||
let cli: CodeQLCliServer;
|
||||
@@ -49,39 +49,44 @@ describe("Databases", () => {
|
||||
await cleanDatabases(databaseManager);
|
||||
});
|
||||
|
||||
it("should add a database from a folder", async () => {
|
||||
const uri = Uri.file(dbLoc);
|
||||
let dbItem = await importArchiveDatabase(
|
||||
uri.toString(true),
|
||||
databaseManager,
|
||||
storagePath,
|
||||
progressCallback,
|
||||
{} as CancellationToken,
|
||||
cli,
|
||||
);
|
||||
expect(dbItem).toBe(databaseManager.currentDatabaseItem);
|
||||
expect(dbItem).toBe(databaseManager.databaseItems[0]);
|
||||
expect(dbItem).toBeDefined();
|
||||
dbItem = dbItem!;
|
||||
expect(dbItem.name).toBe("db");
|
||||
expect(dbItem.databaseUri.fsPath).toBe(join(storagePath, "db", "db"));
|
||||
describe("importArchiveDatabase", () => {
|
||||
it("should add a database from a folder", async () => {
|
||||
const uri = Uri.file(dbLoc);
|
||||
let dbItem = await importArchiveDatabase(
|
||||
uri.toString(true),
|
||||
databaseManager,
|
||||
storagePath,
|
||||
progressCallback,
|
||||
{} as CancellationToken,
|
||||
cli,
|
||||
);
|
||||
expect(dbItem).toBe(databaseManager.currentDatabaseItem);
|
||||
expect(dbItem).toBe(databaseManager.databaseItems[0]);
|
||||
expect(dbItem).toBeDefined();
|
||||
dbItem = dbItem!;
|
||||
expect(dbItem.name).toBe("db");
|
||||
expect(dbItem.databaseUri.fsPath).toBe(join(storagePath, "db", "db"));
|
||||
});
|
||||
});
|
||||
|
||||
it("should add a database from a url", async () => {
|
||||
inputBoxStub.mockResolvedValue(DB_URL);
|
||||
describe("promptImportInternetDatabase", () => {
|
||||
it("should add a database from a url", async () => {
|
||||
// Provide a database URL when prompted
|
||||
inputBoxStub.mockResolvedValue(DB_URL);
|
||||
|
||||
let dbItem = await promptImportInternetDatabase(
|
||||
databaseManager,
|
||||
storagePath,
|
||||
progressCallback,
|
||||
{} as CancellationToken,
|
||||
cli,
|
||||
);
|
||||
expect(dbItem).toBeDefined();
|
||||
dbItem = dbItem!;
|
||||
expect(dbItem.name).toBe("db");
|
||||
expect(dbItem.databaseUri.fsPath).toBe(
|
||||
join(storagePath, "simple-db", "db"),
|
||||
);
|
||||
let dbItem = await promptImportInternetDatabase(
|
||||
databaseManager,
|
||||
storagePath,
|
||||
progressCallback,
|
||||
{} as CancellationToken,
|
||||
cli,
|
||||
);
|
||||
expect(dbItem).toBeDefined();
|
||||
dbItem = dbItem!;
|
||||
expect(dbItem.name).toBe("db");
|
||||
expect(dbItem.databaseUri.fsPath).toBe(
|
||||
join(storagePath, "simple-db", "db"),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -459,7 +459,7 @@ describe("QueryHistoryManager", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("should change the selection", () => {
|
||||
it.skip("should change the selection", () => {
|
||||
expect(queryHistoryManager.treeDataProvider.getCurrent()).toBe(
|
||||
newSelected,
|
||||
);
|
||||
@@ -561,7 +561,7 @@ describe("QueryHistoryManager", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("should change the selection", () => {
|
||||
it.skip("should change the selection", () => {
|
||||
expect(queryHistoryManager.treeDataProvider.getCurrent()).toEqual(
|
||||
newSelected,
|
||||
);
|
||||
@@ -1272,7 +1272,7 @@ describe("QueryHistoryManager", () => {
|
||||
await p;
|
||||
});
|
||||
|
||||
it("should get the selection from the treeDataProvider when both selections and the treeView are empty", async () => {
|
||||
it.skip("should get the selection from the treeDataProvider when both selections and the treeView are empty", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
await queryHistoryManager.treeView.reveal(allHistory[1], {
|
||||
select: true,
|
||||
|
||||
@@ -125,7 +125,7 @@ describe("serialize and deserialize", () => {
|
||||
}
|
||||
});
|
||||
expectedHistory.forEach((info) => {
|
||||
if (info.t == "local" && info.completedQuery) {
|
||||
if (info.t === "local" && info.completedQuery) {
|
||||
(info.completedQuery as any).dispose = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user