File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
src/view/common/CodePaths Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 22
33## [ UNRELEASED]
44
5+ - Update variant analysis view to display the length of the shortest path for path queries. [ #3671 ] ( https://github.com/github/vscode-codeql/pull/3671 )
6+
57## 1.13.1 - 29 May 2024
68
79- Fix a bug when re-importing test databases that erroneously showed old source code. [ #3616 ] ( https://github.com/github/vscode-codeql/pull/3616 )
Original file line number Diff line number Diff line change @@ -12,6 +12,18 @@ const ShowPathsLink = styled(VSCodeLink)`
1212 cursor: pointer;
1313` ;
1414
15+ const Label = styled . span `
16+ color: var(--vscode-descriptionForeground);
17+ margin-left: 10px;
18+ ` ;
19+
20+ function getShortestPathLength ( codeFlows : CodeFlow [ ] ) : number {
21+ const allPathLengths = codeFlows
22+ . map ( ( codeFlow ) => codeFlow . threadFlows . length )
23+ . flat ( ) ;
24+ return Math . min ( ...allPathLengths ) ;
25+ }
26+
1527export type CodePathsProps = {
1628 codeFlows : CodeFlow [ ] ;
1729 ruleDescription : string ;
@@ -40,6 +52,7 @@ export const CodePaths = ({
4052 return (
4153 < >
4254 < ShowPathsLink onClick = { onShowPathsClick } > Show paths</ ShowPathsLink >
55+ < Label > (Shortest: { getShortestPathLength ( codeFlows ) } )</ Label >
4356 </ >
4457 ) ;
4558} ;
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ describe(CodePaths.name, () => {
2424 expect ( screen . getByText ( "Show paths" ) ) . toBeInTheDocument ( ) ;
2525 } ) ;
2626
27+ it ( "renders shortest path for code flows" , ( ) => {
28+ render ( ) ;
29+
30+ expect ( screen . getByText ( "(Shortest: 1)" ) ) . toBeInTheDocument ( ) ;
31+ } ) ;
32+
2733 it ( "posts extension message when 'show paths' link clicked" , async ( ) => {
2834 render ( ) ;
2935
You can’t perform that action at this time.
0 commit comments