@@ -27,14 +27,6 @@ func reportCoverage(w io.Writer, result AnalyzeResult) {
2727 tabber := tabwriter .NewWriter (w , 1 , 8 , 2 , '\t' , 0 ) //nolint:mnd // relax
2828 defer tabber .Flush ()
2929
30- statusStr := func (passing bool ) string {
31- if passing {
32- return "PASS"
33- }
34-
35- return "FAIL"
36- }
37-
3830 thr := result .Threshold
3931
4032 if thr .File > 0 || result .HasFileOverrides { // File threshold report
@@ -103,13 +95,19 @@ func reportDiff(w io.Writer, result AnalyzeResult) {
10395 tabber := tabwriter .NewWriter (w , 1 , 8 , 2 , '\t' , 0 ) //nolint:mnd // relax
10496 defer tabber .Flush ()
10597
98+ if result .DiffThreshold != nil {
99+ status := statusStr (result .MeetsDiffThreshold ())
100+ fmt .Fprintf (tabber , "\n Coverage difference threshold (%.2f%%) satisfied:\t %s" , * result .DiffThreshold , status )
101+ fmt .Fprintf (tabber , "\n Coverage difference: %.2f%%\n " , result .DiffPercentage )
102+ }
103+
106104 if len (result .Diff ) == 0 {
107- fmt .Fprintf (tabber , "\n Current tests coverage has not changed .\n " )
105+ fmt .Fprintf (tabber , "\n No coverage changes in any files compared to the base .\n " )
108106 return
109107 }
110108
111- td := TotalLinesDiff (result .Diff )
112- fmt .Fprintf (tabber , "\n Current tests coverage has changed with %d lines missing coverage." , td )
109+ td := TotalLinesMissingCoverage (result .Diff )
110+ fmt .Fprintf (tabber , "\n Test coverage has changed in the current files, with %d lines missing coverage." , td )
113111 fmt .Fprintf (tabber , "\n file:\t uncovered:\t current coverage:\t base coverage:" )
114112
115113 for _ , d := range result .Diff {
@@ -242,3 +240,11 @@ func compressUncoveredLines(w io.Writer, ull []int) {
242240 printRange (last , ull [len (ull )- 1 ])
243241 }
244242}
243+
244+ func statusStr (passing bool ) string {
245+ if passing {
246+ return "PASS"
247+ }
248+
249+ return "FAIL"
250+ }
0 commit comments