Help with how to troubleshoot code analysis upload


(Josh Rogers) #1

Summary of problem:
No code coverage showing up in SonarQube. Code smells show up…but no coverage

SonarQube Version: 7.2.0.13530
SonarC# Languages Code Analyzer for C# * 7.3 (build 5690) installed
** Sonar Scaner Plugin in Jenkins - v2.8

Find attached two files that show from Jenkins and then on SonarQube the background job. The result is no code coverage at all, shows 0%, while in the logs in Jenkins you see:
Calculating coverage result…
Generating report ‘c:\Jenkins\workspace\SonarQube\MerchandisingContentApi.Tests\coverage.opencover.xml’

±------------------------±-------±-------±-------+
| Module | Line | Branch | Method |
±------------------------±-------±-------±-------+
| MerchandisingContentApi | 32.4% | 40.2% | 39.5% |
±------------------------±-------±-------±-------+

Ideas?sonarBackgroundJob.txt (13.9 KB)
logForSonar.txt (212.6 KB)


(Colin Mueller) #2

You’re going to need to change the following to actualy be the path of your opencover result (not a directory, if that was what you are going for)

sonar.cs.opencover.reportsPaths=MerchandisingContentApi.Tests

Colin


(Josh Rogers) #3

Thanks Colin,

I had attempted to do that before with the same result. That said, I did this again, I modified the path to be MerchandisingContentApi.Tests/coverage.opencover.xml.

And still no values in SonarQube…

I do notice a lot of debug logs like, “File ‘MerchandisingContentApi/Controllers/ContentResponseController.cs’ was already processed. Skip it”. Is that any hint?

Added after original post
The part that seems strange to me…it shows “code smells” and “duplication”, just not coverage. I created a new project to see if maybe the old project in SonarQube had some issues…but same result…

Thanks


(Josh Rogers) #4

I was able to figure this out. It seems that the parameter we were using to pass the report name included a semi-colon at the end, so it wasn’t finding the report.
Would have been helpful, for a debug message saying, expected report but file was not found, so no coverage uploaded or something like that.

Thanks again Colin for your help.