diff --git a/src/api/dto/lint-error.dto.ts b/src/api/dto/lint-error.dto.ts new file mode 100644 index 0000000..9728420 --- /dev/null +++ b/src/api/dto/lint-error.dto.ts @@ -0,0 +1,9 @@ +export interface LintErrorDTO { + message: string; + + line: number | null; + + column: number | null; + + offset: number | null; +} diff --git a/src/components/Benchmarks/BenchmarkDetail.tsx b/src/components/Benchmarks/BenchmarkDetail.tsx index c8f3375..691f61a 100644 --- a/src/components/Benchmarks/BenchmarkDetail.tsx +++ b/src/components/Benchmarks/BenchmarkDetail.tsx @@ -87,6 +87,7 @@ const BenchmarkDetail = ({ qualityScore={jobData.qualityScore} cyclomaticComplexity={jobData.cyclomaticComplexity} lintScore={jobData.lintScore} + lintErrors={jobData.lintErrors} isLoading={isProcessing} /> ); diff --git a/src/components/Benchmarks/Result.tsx b/src/components/Benchmarks/Result.tsx index 73465c5..05f1f32 100644 --- a/src/components/Benchmarks/Result.tsx +++ b/src/components/Benchmarks/Result.tsx @@ -1,5 +1,6 @@ import React from 'react'; import Loader from 'react-loader-spinner'; +import { LintErrorDTO } from '../../api/dto/lint-error.dto'; interface LayoutProps { status: string; message: string; @@ -11,6 +12,7 @@ interface LayoutProps { qualityScore?: number; cyclomaticComplexity?: number; lintScore?: number; + lintErrors?: LintErrorDTO[]; isLoading: boolean; } @@ -24,6 +26,7 @@ const Result: React.FC = ({ memUsage, qualityScore, lintScore, + lintErrors, isLoading, cyclomaticComplexity, }) => { @@ -58,6 +61,11 @@ const Result: React.FC = ({ value={stdout} isLoading={isLoading} /> + = ({ text, value }) => { } }; +interface LinterOutputProps { + text?: string; + lintErrors?: LintErrorDTO[]; + isLoading: boolean; +} + +const LinterOutput: React.FC = ({ text, lintErrors }) => { + if (lintErrors) { + return ( +
+ {text}: +
+ {lintErrors.map((error, i) => ( +

+ {error.column}:{error.line}: {error.message} +

+ ))} +
+
+ ); + } else { + return
; + } +}; + interface ScoresComponentProps { status: string | undefined; qualityScore: number | undefined; diff --git a/src/hooks/submissions.ts b/src/hooks/submissions.ts index 46e6c0b..c18269c 100644 --- a/src/hooks/submissions.ts +++ b/src/hooks/submissions.ts @@ -1,5 +1,6 @@ import { useState } from 'react'; import { useMutation, useQuery } from 'react-query'; +import { LintErrorDTO } from '../api/dto/lint-error.dto'; import authenticatedRequest from '../components/utils/request'; import { useToken } from './token'; @@ -67,6 +68,7 @@ function useProcessInterval({ qualityScore: number; cyclomaticComplexity: number; lintScore: number; + lintErrors?: LintErrorDTO[]; }; } = await authenticatedRequest({ url: `submissions/${processId}`,