File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
src/components/leaderboard Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,14 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
55
55
return 1 ;
56
56
}
57
57
return 0 ;
58
+ case 'cyclomaticComplexity' :
59
+ if ( row1 . cyclomaticComplexity ! < row2 . cyclomaticComplexity ! ) {
60
+ return - 1 ;
61
+ }
62
+ if ( row1 . cyclomaticComplexity ! > row2 . cyclomaticComplexity ! ) {
63
+ return 1 ;
64
+ }
65
+ return 0 ;
58
66
}
59
67
return 0 ;
60
68
}
@@ -240,6 +248,20 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
240
248
/>
241
249
</ div >
242
250
</ th >
251
+ < th
252
+ scope = "col"
253
+ className = "dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
254
+ onClick = { ( ) => setSortedField ( 'cyclomaticComplexity' ) }
255
+ >
256
+ < div className = "flex" >
257
+ Cyclomatic complexity
258
+ < img
259
+ className = "w-4 h-4 ml-2"
260
+ alt = "Sort by lint score"
261
+ src = "https://image.flaticon.com/icons/png/512/162/162735.png"
262
+ />
263
+ </ div >
264
+ </ th >
243
265
< th
244
266
scope = "col"
245
267
className = "dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
@@ -313,6 +335,9 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
313
335
< td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-500" >
314
336
{ row . execDuration }
315
337
</ td >
338
+ < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-500" >
339
+ { row . cyclomaticComplexity }
340
+ </ td >
316
341
< td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-500" >
317
342
{ row . duplicatedSubmissions
318
343
? row . duplicatedSubmissions . length
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export default class LeaderboardModel {
6
6
memUsage : number | undefined ;
7
7
execDuration : number | undefined ;
8
8
createdAt : string | undefined ;
9
+ cyclomaticComplexity : number | undefined ;
9
10
duplicatedSubmissions : [ ] | undefined ;
10
11
user :
11
12
| {
You can’t perform that action at this time.
0 commit comments