@@ -69,7 +69,7 @@ func reportIssuesForHuman(w io.Writer, coverageStats []coverage.Stats) {
6969}
7070
7171func reportUncoveredLines (w io.Writer , result AnalyzeResult ) {
72- if result .Pass () || len (result .FilesWithUncoveredLines ) == 0 {
72+ if result .PassCoverage () || len (result .FilesWithUncoveredLines ) == 0 {
7373 return
7474 }
7575
@@ -97,11 +97,11 @@ func reportMissingExplanations(w io.Writer, result AnalyzeResult) {
9797 tabber := tabwriter .NewWriter (w , 1 , 8 , 2 , '\t' , 0 ) //nolint:mnd // relax
9898 defer tabber .Flush ()
9999
100- fmt .Fprintf (tabber , "\n Files with missing explanations for coverage-ignore annotations :" )
100+ fmt .Fprintf (tabber , "\n Files with missing explanation for coverage-ignore annotation :" )
101101 fmt .Fprintf (tabber , "\n file:\t line numbers:" )
102102
103103 for _ , stats := range result .FilesWithMissingExplanations {
104- if len (stats .AnnotationsWithoutComments ) == 0 {
104+ if len (stats .AnnotationsWithoutComments ) == 0 { // coverage-ignore
105105 continue
106106 }
107107
@@ -155,8 +155,8 @@ func ReportForGithubAction(w io.Writer, result AnalyzeResult) {
155155 out := bufio .NewWriter (w )
156156 defer out .Flush ()
157157
158- reportLineError := func (file , title , msg string ) {
159- fmt .Fprintf (out , "::error file=%s,title=%s,line=1 ::%s\n " , file , title , msg )
158+ reportLineError := func (file , title , msg string , line int ) {
159+ fmt .Fprintf (out , "::error file=%s,title=%s,line=%d ::%s\n " , file , title , line , msg )
160160 }
161161 reportError := func (title , msg string ) {
162162 fmt .Fprintf (out , "::error title=%s::%s\n " , title , msg )
@@ -168,7 +168,7 @@ func ReportForGithubAction(w io.Writer, result AnalyzeResult) {
168168 "%s: coverage: %s; threshold: %d%%" ,
169169 title , stats .Str (), stats .Threshold ,
170170 )
171- reportLineError (stats .Name , title , msg )
171+ reportLineError (stats .Name , title , msg , 1 )
172172 }
173173
174174 for _ , stats := range result .PackagesBelowThreshold {
@@ -189,17 +189,12 @@ func ReportForGithubAction(w io.Writer, result AnalyzeResult) {
189189 reportError (title , msg )
190190 }
191191
192- // Report missing explanations for coverage-ignore annotations
193192 for _ , stats := range result .FilesWithMissingExplanations {
194- if len (stats .AnnotationsWithoutComments ) > 0 {
195- for _ , ann := range stats .AnnotationsWithoutComments {
196- title := "Missing explanation for coverage-ignore"
197- msg := title + ": add an explanation after the coverage-ignore annotation"
198-
199- file := stats .Name
200- lineNumber := ann
201- fmt .Fprintf (out , "::error file=%s,title=%s,line=%d::%s\n " , file , title , lineNumber , msg )
202- }
193+ for _ , line := range stats .AnnotationsWithoutComments {
194+ title := "Missing explanation for coverage-ignore"
195+ msg := title + ": add an explanation after the coverage-ignore annotation"
196+
197+ reportLineError (stats .Name , title , msg , line )
203198 }
204199 }
205200}
0 commit comments