@@ -13,6 +13,7 @@ import { getRefinedChecks } from "../utils/comparator/getRefinedChecks";
13
13
import { areEqualElements } from "../utils/comparator/areEqualElements" ;
14
14
15
15
import "../styles/ProjectDetails.css" ;
16
+ import "../styles/ProjectComparator.css" ;
16
17
17
18
function ProjectComparator ( ) {
18
19
const params = useParams ( ) ;
@@ -21,6 +22,7 @@ function ProjectComparator() {
21
22
const [ consolidatedData , setConsolidatedData ] = useState <
22
23
ConsolidatedScoreElement [ ]
23
24
> ( [ ] ) ;
25
+ const [ discrepancies , setDiscrepancies ] = useState < string [ ] > ( [ ] ) ;
24
26
25
27
const prevCommitQuery = useQuery ( {
26
28
queryKey : [ "prevCommit" ] ,
@@ -53,18 +55,16 @@ function ProjectComparator() {
53
55
54
56
useEffect ( ( ) => {
55
57
const areEqualDetails = ( ) => {
56
- let consolidatedData ;
57
-
58
58
if ( ! previousData ?. checks || ! previousData ?. score ) {
59
59
return ;
60
60
}
61
61
62
- const { common } = getRefinedChecks (
62
+ const refinedChecks = getRefinedChecks (
63
63
previousData ?. checks ,
64
64
currentData ?. checks ,
65
65
) ;
66
66
67
- consolidatedData = common . map ( ( name : string ) => {
67
+ const data = refinedChecks . common . map ( ( name : string ) => {
68
68
const previousElement = previousData ?. checks ?. filter (
69
69
( el : ScoreElement ) => el . name === name ,
70
70
) [ 0 ] ;
@@ -84,7 +84,8 @@ function ProjectComparator() {
84
84
prevScore : previousElement . score ,
85
85
} ;
86
86
} ) ;
87
- setConsolidatedData ( consolidatedData ) ;
87
+ setConsolidatedData ( data ) ;
88
+ setDiscrepancies ( refinedChecks . discrepancies ) ;
88
89
} ;
89
90
areEqualDetails ( ) ;
90
91
} , [ currentData , previousData ] ) ;
@@ -136,6 +137,14 @@ function ProjectComparator() {
136
137
{ `(${ currentData . scorecard . commit . substring ( 0 , 8 ) } )` }
137
138
</ a >
138
139
</ p >
140
+ { discrepancies . length > 0 && (
141
+ < span
142
+ className = "warning-message"
143
+ data-testid = "discrepancies"
144
+ > { `The report doesn't display certain checks (such as ${ discrepancies . join (
145
+ ", " ,
146
+ ) } ) because they haven't been included in the analysis of both commits.`} </ span >
147
+ ) }
139
148
< hr />
140
149
{ Array . isArray ( consolidatedData ) &&
141
150
consolidatedData . map ( ( element : ConsolidatedScoreElement ) => (
0 commit comments