Move unused languageToDbScheme

This commit is contained in:
Koen Vlaswinkel
2023-06-12 11:01:42 +02:00
parent 706c6b8a7a
commit b0c18b3300
2 changed files with 10 additions and 22 deletions

View File

@@ -357,24 +357,6 @@ export async function prepareCodeTour(
* The following functions al heuristically determine metadata about databases.
*/
/**
* Note that this heuristic is only being used for backwards compatibility with
* CLI versions before the langauge name was introduced to dbInfo. Features
* that do not require backwards compatibility should call
* `cli.CodeQLCliServer.resolveDatabase` and use the first entry in the
* `languages` property.
*
* @see cli.CodeQLCliServer.resolveDatabase
*/
export const languageToDbScheme = Object.entries(dbSchemeToLanguage).reduce(
(acc, [k, v]) => {
acc[v] = k;
return acc;
},
{} as { [k: string]: string },
);
/**
* Returns the initial contents for an empty query, based on the language of the selected
* databse.

View File

@@ -7,15 +7,13 @@ import {
QueryInfoByLanguage,
} from "../../../src/codeql-cli/cli";
import { itWithCodeQL } from "../cli";
import {
getOnDiskWorkspaceFolders,
languageToDbScheme,
} from "../../../src/helpers";
import { getOnDiskWorkspaceFolders } from "../../../src/helpers";
import { KeyType, resolveQueries } from "../../../src/language-support";
import { faker } from "@faker-js/faker";
import { getActivatedExtension } from "../global.helper";
import { BaseLogger } from "../../../src/common";
import { getQlPackForDbscheme } from "../../../src/databases/qlpack";
import { dbSchemeToLanguage } from "../../../src/common/query-language";
/**
* Perform proper integration tests by running the CLI
@@ -26,6 +24,14 @@ describe("Use cli", () => {
let logSpy: jest.SpiedFunction<BaseLogger["log"]>;
const languageToDbScheme = Object.entries(dbSchemeToLanguage).reduce(
(acc, [k, v]) => {
acc[v] = k;
return acc;
},
{} as { [k: string]: string },
);
beforeEach(async () => {
const extension = await getActivatedExtension();
cli = extension.cliServer;