Skip to content

Commit eb9d12b

Browse files
committed
Remove check for generateSummarySymbolMap CLI feature
1 parent 9c8d331 commit eb9d12b

File tree

4 files changed

+3
-128
lines changed

4 files changed

+3
-128
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ interface VersionResult {
1111

1212
export interface CliFeatures {
1313
featuresInVersionResult?: boolean;
14-
generateSummarySymbolMap?: boolean;
1514
queryServerRunQueries?: boolean;
1615
}
1716

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export class CodeQLCliServer implements Disposable {
269269
/** Path to current codeQL executable, or undefined if not running yet. */
270270
codeQlPath: string | undefined;
271271

272-
cliConstraints = new CliVersionConstraint(this);
272+
cliConstraints = new CliVersionConstraint();
273273

274274
/**
275275
* When set to true, ignore some modal popups and assume user has clicked "yes".
@@ -1191,15 +1191,12 @@ export class CodeQLCliServer implements Disposable {
11911191
outputPath: string,
11921192
endSummaryPath: string,
11931193
): Promise<string> {
1194-
const supportsGenerateSummarySymbolMap =
1195-
await this.cliConstraints.supportsGenerateSummarySymbolMap();
11961194
const subcommandArgs = [
11971195
"--format=text",
11981196
`--end-summary=${endSummaryPath}`,
11991197
"--sourcemap",
1200-
...(supportsGenerateSummarySymbolMap
1201-
? ["--summary-symbol-map", "--minify-output"]
1202-
: []),
1198+
"--summary-symbol-map",
1199+
"--minify-output",
12031200
inputPath,
12041201
outputPath,
12051202
];
@@ -1905,12 +1902,4 @@ export class CliVersionConstraint {
19051902
// The oldest version of the CLI that we support. This is used to determine
19061903
// whether to show a warning about the CLI being too old on startup.
19071904
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.18.4");
1908-
1909-
constructor(private readonly cli: CodeQLCliServer) {
1910-
/**/
1911-
}
1912-
1913-
async supportsGenerateSummarySymbolMap(): Promise<boolean> {
1914-
return (await this.cli.getFeatures()).generateSummarySymbolMap === true;
1915-
}
19161905
}
Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import { createReadStream, writeFile } from "fs-extra";
2-
import { LINE_ENDINGS, splitStreamAtSeparators } from "../common/split-stream";
3-
41
/**
52
* Location information for a single pipeline invocation in the RA.
63
*/
@@ -32,103 +29,3 @@ interface PredicateSymbol {
3229
export interface SummarySymbols {
3330
predicates: Record<string, PredicateSymbol>;
3431
}
35-
36-
// Tuple counts for Expr::Expr::getParent#dispred#f0820431#ff@76d6745o:
37-
const NON_RECURSIVE_TUPLE_COUNT_REGEXP =
38-
/^Evaluated relational algebra for predicate (?<predicateName>\S+) with tuple counts:$/;
39-
// Tuple counts for Expr::Expr::getEnclosingStmt#f0820431#bf@923ddwj9 on iteration 0 running pipeline base:
40-
const RECURSIVE_TUPLE_COUNT_REGEXP =
41-
/^Evaluated relational algebra for predicate (?<predicateName>\S+) on iteration (?<iteration>\d+) running pipeline (?<pipeline>\S+) with tuple counts:$/;
42-
const RETURN_REGEXP = /^\s*return /;
43-
44-
/**
45-
* Parse a human-readable evaluation log summary to find the location of the RA for each pipeline
46-
* run.
47-
*
48-
* TODO: Once we're more certain about the symbol format, we should have the CLI generate this as it
49-
* generates the human-readabe summary to avoid having to rely on regular expression matching of the
50-
* human-readable text.
51-
*
52-
* @param summaryPath The path to the summary file.
53-
* @param symbolsPath The path to the symbols file to generate.
54-
*/
55-
export async function generateSummarySymbolsFile(
56-
summaryPath: string,
57-
symbolsPath: string,
58-
): Promise<void> {
59-
const symbols = await generateSummarySymbols(summaryPath);
60-
await writeFile(symbolsPath, JSON.stringify(symbols));
61-
}
62-
63-
/**
64-
* Parse a human-readable evaluation log summary to find the location of the RA for each pipeline
65-
* run.
66-
*
67-
* @param fileLocation The path to the summary file.
68-
* @returns Symbol information for the summary file.
69-
*/
70-
async function generateSummarySymbols(
71-
summaryPath: string,
72-
): Promise<SummarySymbols> {
73-
const stream = createReadStream(summaryPath, {
74-
encoding: "utf-8",
75-
});
76-
try {
77-
const lines = splitStreamAtSeparators(stream, LINE_ENDINGS);
78-
79-
const symbols: SummarySymbols = {
80-
predicates: {},
81-
};
82-
83-
let lineNumber = 0;
84-
let raStartLine = 0;
85-
let iteration = 0;
86-
let predicateName: string | undefined = undefined;
87-
let startLine = 0;
88-
for await (const line of lines) {
89-
if (predicateName === undefined) {
90-
// Looking for the start of the predicate.
91-
const nonRecursiveMatch = line.match(NON_RECURSIVE_TUPLE_COUNT_REGEXP);
92-
if (nonRecursiveMatch) {
93-
iteration = 0;
94-
predicateName = nonRecursiveMatch.groups!.predicateName;
95-
} else {
96-
const recursiveMatch = line.match(RECURSIVE_TUPLE_COUNT_REGEXP);
97-
if (recursiveMatch?.groups) {
98-
predicateName = recursiveMatch.groups.predicateName;
99-
iteration = parseInt(recursiveMatch.groups.iteration);
100-
}
101-
}
102-
if (predicateName !== undefined) {
103-
startLine = lineNumber;
104-
raStartLine = lineNumber + 1;
105-
}
106-
} else {
107-
const returnMatch = line.match(RETURN_REGEXP);
108-
if (returnMatch) {
109-
let symbol = symbols.predicates[predicateName];
110-
if (symbol === undefined) {
111-
symbol = {
112-
iterations: {},
113-
recursionSummaries: {},
114-
};
115-
symbols.predicates[predicateName] = symbol;
116-
}
117-
symbol.iterations[iteration] = {
118-
startLine,
119-
raStartLine,
120-
raEndLine: lineNumber,
121-
};
122-
123-
predicateName = undefined;
124-
}
125-
}
126-
127-
lineNumber++;
128-
}
129-
130-
return symbols;
131-
} finally {
132-
stream.close();
133-
}
134-
}

extensions/ql-vscode/src/run-queries-shared.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import type {
2727
import type { BaseLogger } from "./common/logging";
2828
import { showAndLogWarningMessage } from "./common/logging";
2929
import { extLogger } from "./common/logging/vscode";
30-
import { generateSummarySymbolsFile } from "./log-insights/summary-parser";
3130
import { getErrorMessage } from "./common/helpers-pure";
3231
import { createHash } from "crypto";
3332
import { QueryOutputDir } from "./local-queries/query-output-dir";
@@ -570,15 +569,6 @@ export async function generateEvalLogSummaries(
570569

571570
if (humanReadableSummary !== undefined) {
572571
summarySymbols = outputDir.evalLogSummarySymbolsPath;
573-
if (
574-
!(await cliServer.cliConstraints.supportsGenerateSummarySymbolMap())
575-
) {
576-
// We're using an old CLI that cannot generate the summary symbols file while generating the
577-
// human-readable log summary. As a fallback, create it by parsing the human-readable
578-
// summary.
579-
progress(progressUpdate(3, 3, "Generating summary symbols file"));
580-
await generateSummarySymbolsFile(humanReadableSummary, summarySymbols);
581-
}
582572
}
583573
}
584574

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy