Merge remote-tracking branch 'origin/main' into dbartol/provenance

This commit is contained in:
Dave Bartolomeo
2024-07-29 17:58:46 +00:00
10 changed files with 631 additions and 2503 deletions

View File

@@ -1,6 +1,6 @@
import * as React from "react";
import { addons } from "@storybook/manager-api";
import { Addon_TypesEnum } from "@storybook/types";
import { Addon_TypesEnum } from "storybook/internal/types";
import { ThemeSelector } from "./ThemeSelector";
const ADDON_ID = "vscode-theme-addon";

View File

@@ -2,6 +2,8 @@
## [UNRELEASED]
- Update variant analysis view to display the length of the shortest path for path queries. [#3671](https://github.com/github/vscode-codeql/pull/3671)
## 1.13.1 - 29 May 2024
- Fix a bug when re-importing test databases that erroneously showed old source code. [#3616](https://github.com/github/vscode-codeql/pull/3616)

File diff suppressed because it is too large Load Diff

View File

@@ -2012,21 +2012,21 @@
"@faker-js/faker": "^8.4.1",
"@github/markdownlint-github": "^0.6.2",
"@playwright/test": "^1.40.1",
"@storybook/addon-a11y": "^8.1.11",
"@storybook/addon-actions": "^8.1.11",
"@storybook/addon-essentials": "^8.1.11",
"@storybook/addon-interactions": "^8.1.11",
"@storybook/addon-links": "^8.1.11",
"@storybook/addon-a11y": "^8.2.6",
"@storybook/addon-actions": "^8.2.6",
"@storybook/addon-essentials": "^8.2.6",
"@storybook/addon-interactions": "^8.2.6",
"@storybook/addon-links": "^8.2.6",
"@storybook/blocks": "^8.0.2",
"@storybook/components": "^8.0.2",
"@storybook/components": "^8.2.6",
"@storybook/csf": "^0.1.11",
"@storybook/icons": "^1.2.9",
"@storybook/manager-api": "^8.1.11",
"@storybook/react": "^8.1.11",
"@storybook/react-vite": "^8.1.11",
"@storybook/theming": "^8.1.11",
"@testing-library/dom": "^10.3.0",
"@testing-library/jest-dom": "^6.4.6",
"@storybook/manager-api": "^8.2.6",
"@storybook/react": "^8.2.6",
"@storybook/react-vite": "^8.2.6",
"@storybook/theming": "^8.2.4",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/child-process-promise": "^2.2.1",
@@ -2071,7 +2071,7 @@
"eslint-plugin-jest-dom": "^5.2.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.8.0",
"glob": "^10.0.0",
"gulp": "^5.0.0",
@@ -2088,7 +2088,7 @@
"npm-run-all": "^4.1.5",
"patch-package": "^8.0.0",
"prettier": "^3.2.5",
"storybook": "^8.1.11",
"storybook": "^8.2.6",
"tar-stream": "^3.1.7",
"through2": "^4.0.2",
"ts-jest": "^29.1.4",

View File

@@ -12,6 +12,7 @@ interface VersionResult {
export interface CliFeatures {
featuresInVersionResult?: boolean;
mrvaPackCreate?: boolean;
generateSummarySymbolMap?: boolean;
}
export interface VersionAndFeatures {

View File

@@ -1211,10 +1211,15 @@ export class CodeQLCliServer implements Disposable {
outputPath: string,
endSummaryPath: string,
): Promise<string> {
const supportsGenerateSummarySymbolMap =
await this.cliConstraints.supportsGenerateSummarySymbolMap();
const subcommandArgs = [
"--format=text",
`--end-summary=${endSummaryPath}`,
"--sourcemap",
...(supportsGenerateSummarySymbolMap
? ["--summary-symbol-map", "--minify-output"]
: []),
inputPath,
outputPath,
];
@@ -1953,4 +1958,8 @@ export class CliVersionConstraint {
async supportsMrvaPackCreate(): Promise<boolean> {
return (await this.cli.getFeatures()).mrvaPackCreate === true;
}
async supportsGenerateSummarySymbolMap(): Promise<boolean> {
return (await this.cli.getFeatures()).generateSummarySymbolMap === true;
}
}

View File

@@ -544,9 +544,16 @@ export async function generateEvalLogSummaries(
await cliServer.generateJsonLogSummary(log, jsonSummary);
if (humanReadableSummary !== undefined) {
progress(progressUpdate(3, 3, "Generating summary symbols file"));
summarySymbols = outputDir.evalLogSummarySymbolsPath;
await generateSummarySymbolsFile(humanReadableSummary, summarySymbols);
if (
!(await cliServer.cliConstraints.supportsGenerateSummarySymbolMap())
) {
// We're using an old CLI that cannot generate the summary symbols file while generating the
// human-readable log summary. As a fallback, create it by parsing the human-readable
// summary.
progress(progressUpdate(3, 3, "Generating summary symbols file"));
await generateSummarySymbolsFile(humanReadableSummary, summarySymbols);
}
}
}

View File

@@ -12,6 +12,18 @@ const ShowPathsLink = styled(VSCodeLink)`
cursor: pointer;
`;
const Label = styled.span`
color: var(--vscode-descriptionForeground);
margin-left: 10px;
`;
function getShortestPathLength(codeFlows: CodeFlow[]): number {
const allPathLengths = codeFlows
.map((codeFlow) => codeFlow.threadFlows.length)
.flat();
return Math.min(...allPathLengths);
}
export type CodePathsProps = {
codeFlows: CodeFlow[];
ruleDescription: string;
@@ -40,6 +52,7 @@ export const CodePaths = ({
return (
<>
<ShowPathsLink onClick={onShowPathsClick}>Show paths</ShowPathsLink>
<Label>(Shortest: {getShortestPathLength(codeFlows)})</Label>
</>
);
};

View File

@@ -24,6 +24,12 @@ describe(CodePaths.name, () => {
expect(screen.getByText("Show paths")).toBeInTheDocument();
});
it("renders shortest path for code flows", () => {
render();
expect(screen.getByText("(Shortest: 1)")).toBeInTheDocument();
});
it("posts extension message when 'show paths' link clicked", async () => {
render();

View File

@@ -1,5 +1,5 @@
[
"v2.18.0",
"v2.18.1",
"v2.17.6",
"v2.16.6",
"v2.15.5",