Skip to content

Commit 84afb64

Browse files
committed
feat: cyclo complexity in result component
1 parent 67ec6f7 commit 84afb64

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

src/components/Benchmarks/BenchmarkDetail.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const BenchmarkDetail = ({
8585
execDuration={jobData.execDuration}
8686
memUsage={jobData.memUsage}
8787
qualityScore={jobData.qualityScore}
88+
cyclomaticComplexity={jobData.cyclomaticComplexity}
8889
lintScore={jobData.lintScore}
8990
isLoading={isProcessing}
9091
/>

src/components/Benchmarks/Result.tsx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface LayoutProps {
99
execDuration?: number;
1010
memUsage?: number;
1111
qualityScore?: number;
12+
cyclomaticComplexity?: number;
1213
lintScore?: number;
1314
isLoading: boolean;
1415
}
@@ -24,6 +25,7 @@ const Result: React.FC<LayoutProps> = ({
2425
qualityScore,
2526
lintScore,
2627
isLoading,
28+
cyclomaticComplexity,
2729
}) => {
2830
if (status !== 'done' && status !== 'error') {
2931
return (
@@ -47,6 +49,7 @@ const Result: React.FC<LayoutProps> = ({
4749
lintScore={lintScore}
4850
memUsage={memUsage}
4951
execDuration={execDuration}
52+
cyclomaticComplexity={cyclomaticComplexity}
5053
/>
5154
</div>
5255
<div className="w-3/5 pl-6">
@@ -100,6 +103,7 @@ interface ScoresComponentProps {
100103
lintScore: number | undefined;
101104
memUsage: number | undefined;
102105
execDuration: number | undefined;
106+
cyclomaticComplexity: number | undefined;
103107
}
104108

105109
const ScoresComponent: React.FC<ScoresComponentProps> = ({
@@ -108,6 +112,7 @@ const ScoresComponent: React.FC<ScoresComponentProps> = ({
108112
lintScore,
109113
memUsage,
110114
execDuration,
115+
cyclomaticComplexity,
111116
}) => {
112117
return (
113118
<div className="relative flex flex-col min-w-0 mb-4 lg:mb-0 break-words bg-gray-50 dark:bg-gray-800 w-full shadow-lg rounded">
@@ -123,10 +128,10 @@ const ScoresComponent: React.FC<ScoresComponentProps> = ({
123128
<table className="items-center w-full bg-transparent border-collapse">
124129
<tbody>
125130
<tr className="text-gray-700 dark:text-gray-100">
126-
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4 text-left">
131+
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3 text-left">
127132
Exit status
128133
</th>
129-
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4">
134+
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3">
130135
<div className="flex items-center">
131136
<span className="mr-2">
132137
{status === 'done' ? '✅' : '❌'}
@@ -135,10 +140,10 @@ const ScoresComponent: React.FC<ScoresComponentProps> = ({
135140
</td>
136141
</tr>
137142
<tr className="text-gray-700 dark:text-gray-100">
138-
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4 text-left">
143+
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3 text-left">
139144
Quality score
140145
</th>
141-
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4">
146+
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3">
142147
<div className="flex items-center">
143148
<span className="mr-2">{qualityScore}</span>
144149
<div className="relative w-full">
@@ -153,10 +158,10 @@ const ScoresComponent: React.FC<ScoresComponentProps> = ({
153158
</td>
154159
</tr>
155160
<tr className="text-gray-700 dark:text-gray-100">
156-
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4 text-left">
161+
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3 text-left">
157162
Lint score
158163
</th>
159-
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4">
164+
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3">
160165
<div className="flex items-center">
161166
<span className="mr-2">{lintScore}</span>
162167
<div className="relative w-full">
@@ -171,25 +176,35 @@ const ScoresComponent: React.FC<ScoresComponentProps> = ({
171176
</td>
172177
</tr>
173178
<tr className="text-gray-700 dark:text-gray-100">
174-
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4 text-left">
179+
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3 text-left">
175180
Execution duration
176181
</th>
177-
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4">
182+
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3">
178183
<div className="flex items-center">
179184
<span className="mr-2">{execDuration} μs</span>
180185
</div>
181186
</td>
182187
</tr>
183188
<tr className="text-gray-700 dark:text-gray-100">
184-
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4 text-left">
189+
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3 text-left">
185190
Max. memory usage
186191
</th>
187-
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-4">
192+
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3">
188193
<div className="flex items-center">
189194
<span className="mr-2">{memUsage} KB</span>
190195
</div>
191196
</td>
192197
</tr>
198+
<tr className="text-gray-700 dark:text-gray-100">
199+
<th className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3 text-left">
200+
Cyclomatic complexity
201+
</th>
202+
<td className="border-t-0 px-4 align-middle border-l-0 border-r-0 text-sm whitespace-nowrap p-3">
203+
<div className="flex items-center">
204+
<span className="mr-2">{cyclomaticComplexity}</span>
205+
</div>
206+
</td>
207+
</tr>
193208
</tbody>
194209
</table>
195210
</div>

src/hooks/submissions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function useProcessInterval({
6565
execDuration: number;
6666
memUsage: number;
6767
qualityScore: number;
68+
cyclomaticComplexity: number;
6869
lintScore: number;
6970
};
7071
} = await authenticatedRequest({

0 commit comments

Comments
 (0)