- ALM used (GitLab)
- CI system used (Gitlab CI)
I’m having a real hard time getting our code gates to be effective. Bugs, vulnerabilities, smells, all of these work fine.
Everything except code coverage.
I’ve built a simple demo repository, structured like so:
~/work/sonartest$ tree . . ├── cmd │ └── sonartest │ ├── main.go │ └── main_test.go ├── go.mod ├── Makefile ├── pkg │ └── addpkg │ ├── main.go │ └── main_test.go └── sonar-project.properties
Nothing too out of the ordinary, just a dumb hello world with a couple simple and easily tested functions.
I’ve tried so many different settings in my
sonar-project.properties (like the sane default suggested here https://docs.sonarqube.org/latest/analysis/languages/go/ which should work just fine), but it always shows that we have 0.0% code coverage.
I’ve also tried manually specifying
sonar.test.inclusions=cmd/sonartest/main_test.go just to see if I could reduce the number of allegedly uncovered lines, and I see no change.
I’ve seen some mention of using third-party tools to generate coverage reports, and then have sonar read those. Is that what I’m missing here?