uartois / sonar-golang

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

The coverage of the calculation is wrong! #73

Open yangwenmai opened 6 years ago

yangwenmai commented 6 years ago

Description

I have some problems in sonarqube-go-demo, that coverage value is not correct.

I got coverage is 87.5% in local, but there is 64.3% in sonarqube.

Steps to Reproduce

There is tips for sonarqube:

image

image

But:

go test ./... -coverprofile=coverage.out
?       github.com/yangwenmai/sonarqube-go-demo [no test files]
ok      github.com/yangwenmai/sonarqube-go-demo/math    0.008s  coverage: 87.5% of statements

I think the coverage of the calculation is wrong!

The coverage's result is 87.5%, not include sonarqube-go-demo/main.go#main()

Content of your sonar-project.properties

sonar.projectKey=demo
sonar.projectName=demo
sonar.sources=.
sonar.exclusions=**/*_test.go,**/vendor/**
sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/vendor/**
sonar.go.coverage.reportPaths=coverage.out
sonar.go.tests.reportPaths=report.json
sonar.go.govet.reportPaths=govet-report.out
sonar.go.golint.reportPaths=golint-report.out
sonar.go.gometalinter.reportPaths=gometalinter-report.out

Versions

Docker images: kennyallen/sonarqube:7.2.1 SonarQube Scanner for Jenkins: 2.6.1 gometalinter: master go: 1.10.3

thibaultfalque commented 5 years ago

Hello @yangwenmai,

I don't understand the 55.6% value. On the screenshot the coverage percent is 64,3%. Could you explain ?