-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The number of executable lines in not-tested source file is no correctly computed #60
Comments
Well, this is the classical behavior: you expect to have 100% coverage when both a.go and b.go are covered by tests. Or did I miss something? Would you like to exclude some files from coverage computation? |
@danielleberre Sorry for the confusion, let me explain a little bit more with an example. Assume we have the following folder: And a.go is, `package main import ( func main() { while b.go is `package main import ( func foo() { After we generated the coverage.xml, report.xml and test.xml, and then run sonar-runner successfully,
As we can see, uncovered lines in a.go should be 2, and b.go should be 1. So, when a certain package contains no test files, each lines of the packages will calculated as uncovered lines, and that is not corrected. |
ok, I see. When files are tested, we rely on the coverage file to detect "executable lines", so that information is correct. When files are not tested, we simply report the number of lines, we do not restrict to executable lines. @thibaultfalque any idea how to count the number of executable lines in untested files? |
We improved the calculation of untested lines. We will publish a release soon. |
@lylex could you test with the last release ? |
@thibaultfalque I have tried the new release with my project, and I still find something unexpected. I believe that is not the same root cause, so I verify this issue and open #61. |
Description
A not-tested source file will over-decrease the code coverage, even if the definitions are all calculated.
Steps to Reproduce
Versions
Versions of your sonar installation (server, sonar-scanner), gometalinter, go and OS.
Sonar Server: 6.5(build 27846)
Sonar-golang Plugin: 1.2.11-rc10
GO: go1.9.2
The text was updated successfully, but these errors were encountered: