Display EntityValue labels in CSV export (#2170)

This commit is contained in:
Gulshan Singh
2023-03-21 04:59:18 -07:00
committed by GitHub
parent 82d03091d0
commit bb0c53d65d
2 changed files with 13 additions and 6 deletions

View File

@@ -3,6 +3,7 @@
## [UNRELEASED]
- Show data flow paths of a variant analysis in a new tab
- Show labels of entities in exported CSV results [#2170](https://github.com/github/vscode-codeql/pull/2170)
## 1.8.0 - 9 March 2023

View File

@@ -30,7 +30,7 @@ import { nanoid } from "nanoid";
import { CodeQLCliServer } from "./cli";
import { SELECT_QUERY_NAME } from "./contextual/locationFinder";
import { DatabaseManager } from "./local-databases";
import { DecodedBqrsChunk } from "./pure/bqrs-cli-types";
import { DecodedBqrsChunk, EntityValue } from "./pure/bqrs-cli-types";
import { extLogger, Logger } from "./common";
import { generateSummarySymbolsFile } from "./log-insights/summary-parser";
import { getErrorMessage } from "./pure/helpers-pure";
@@ -351,11 +351,17 @@ export class QueryEvaluationInfo {
chunk.tuples.forEach((tuple) => {
out.write(
`${tuple
.map((v, i) =>
chunk.columns[i].kind === "String"
? `"${typeof v === "string" ? v.replaceAll('"', '""') : v}"`
: v,
)
.map((v, i) => {
if (chunk.columns[i].kind === "String") {
return `"${
typeof v === "string" ? v.replaceAll('"', '""') : v
}"`;
} else if (chunk.columns[i].kind === "Entity") {
return (v as EntityValue).label;
} else {
return v;
}
})
.join(",")}\n`,
);
});