File tree 3 files changed +21
-0
lines changed
src/view/common/CodePaths
3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## [ UNRELEASED]
4
4
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
+
5
7
## 1.13.1 - 29 May 2024
6
8
7
9
- 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)`
12
12
cursor: pointer;
13
13
` ;
14
14
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
+
15
27
export type CodePathsProps = {
16
28
codeFlows : CodeFlow [ ] ;
17
29
ruleDescription : string ;
@@ -40,6 +52,7 @@ export const CodePaths = ({
40
52
return (
41
53
< >
42
54
< ShowPathsLink onClick = { onShowPathsClick } > Show paths</ ShowPathsLink >
55
+ < Label > (Shortest: { getShortestPathLength ( codeFlows ) } )</ Label >
43
56
</ >
44
57
) ;
45
58
} ;
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ describe(CodePaths.name, () => {
24
24
expect ( screen . getByText ( "Show paths" ) ) . toBeInTheDocument ( ) ;
25
25
} ) ;
26
26
27
+ it ( "renders shortest path for code flows" , ( ) => {
28
+ render ( ) ;
29
+
30
+ expect ( screen . getByText ( "(Shortest: 1)" ) ) . toBeInTheDocument ( ) ;
31
+ } ) ;
32
+
27
33
it ( "posts extension message when 'show paths' link clicked" , async ( ) => {
28
34
render ( ) ;
29
35
You can’t perform that action at this time.
0 commit comments