sonar-golang icon indicating copy to clipboard operation
sonar-golang copied to clipboard

_test.go files are now shown in coverage list

Open Cosby86 opened this issue 7 years ago • 7 comments

Hello all i just updated my sonar plugin to the latest RC (rc12). Despite I added those 2 lines into config file

sonar.test.inclusions=/_test.go sonar.sources.inclusions=/.go

In my coverage file list now are shown _test,go files too

Cosby86 avatar Feb 12 '18 09:02 Cosby86

hi @Cosby86 Could you test with this configuration ?

sonar.sources=./
sonar.tests=./
sonar.test.inclusions=**/**_test.go
sonar.sources.inclusions=**/**.go

thibaultfalque avatar Feb 12 '18 10:02 thibaultfalque

Thank you for the answer. Not _test files are not considered but I have in the list packages where _test.go file are not presents. In the previous version of the plugin only the coverage of those packages where _test.go file is present were listed.

Cosby86 avatar Feb 12 '18 10:02 Cosby86

Yes we have changed the coverage computation. See #56, #60 and #61. If there is not have _test.go in package the sources files of package are covered with 0%.

thibaultfalque avatar Feb 12 '18 13:02 thibaultfalque

It sound good. Is there any way to exclude a package from coverage mesurement?

Cosby86 avatar Feb 12 '18 13:02 Cosby86

I will ask sonarqube to know how use the sonar.coverage.exclusions property (https://docs.sonarqube.org/display/SONAR/Analysis+Parameters)

thibaultfalque avatar Feb 12 '18 17:02 thibaultfalque

@danielleberre we can use the method doesNotMatchPathPatterns of FilePredicates for exclude the patterns of property sonar.coverage.exclusions: http://javadocs.sonarsource.org/6.2.1/apidocs/org/sonar/api/batch/fs/FilePredicates.html#doesNotMatchPathPatterns-java.lang.String:A-

thibaultfalque avatar Feb 13 '18 22:02 thibaultfalque

Hello @Cosby86

Do you have the problem with the latest version ? If not, could you close this issue ?

thibaultfalque avatar Apr 01 '19 09:04 thibaultfalque