uartois / sonar-golang

Sonarqube plugin for the golang language.
GNU Lesser General Public License v3.0
245 stars 32 forks source link

_test.go files are now shown in coverage list #62

Open Cosby86 opened 6 years ago

Cosby86 commented 6 years ago

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

thibaultfalque commented 6 years ago

hi @Cosby86 Could you test with this configuration ?

sonar.sources=./
sonar.tests=./
sonar.test.inclusions=**/**_test.go
sonar.sources.inclusions=**/**.go
Cosby86 commented 6 years ago

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.

thibaultfalque commented 6 years ago

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%.

Cosby86 commented 6 years ago

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

thibaultfalque commented 6 years ago

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

thibaultfalque commented 6 years ago

@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 commented 5 years ago

Hello @Cosby86

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