Sonarcloud not all code coverage is not shown

We are running our pipeline in gitab, where each test projects runs the code coverage and store it in gitlab artifact.
At the last step we run the sonar scanner, where code is analyzed and code coverage is imported.
In the pipeline log, we see that our code coverage files are all imported and added to cache, but not all codecoveage is available when looking into sonarcloud.
SurveyApi has zero coverage in sonarcloud, but the pipeline log for test shows 71%
The sonarscanner pipeline shows that the coverage log is imported OK.
We uses coverlet->OpenCover code coverage.
Any ideas what is wrong ?

sonarscanner_pipeline_log.txt (947.6 KB)

Hey there.

It does look like the report is being parsed

INFO: Parsing the OpenCover report /builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/testCoverage/./SurveyApiTestResult.xml
INFO: Adding this code coverage report to the cache for later reuse: /builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/testCoverage/./SurveyApiTestResult.xml

Setting sonar.verbose=true should give you some additional logging about what’s found in the coverage report.

Considering you have 793 files indexed in your project but only 181 files are found with coverage data, it seems some information could be missing from the report.

INFO: 793 files indexed
....
INFO: Coverage Report Statistics: 186 files, 181 main files, 181 main files with coverage, 5 test files, 0 project excluded files, 0 other language files.

I would also suggest simply running the equivalent of a cat /builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/testCoverage/./SurveyApiTestResult.xml to make sure it really contains the coverage data you expect (regardless of what the previous console output says).

I have made a report from SurveyApiTestResult.xml and attached the screen dump, file is also attached.
The coverage file looks OK.


artifacts (20).zip (373.1 KB)

When enabling sonar logging, my pipeline log get to long. But is contains a hole lot of logging related to this:

10:43:42.288 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, isRacyClean=true, read=2022-04-07 10:43:42.288590000, lastModified=2022-04-07 10:43:42.285241000, delta=3349000 ns, racy<=2500000000 ns
10:43:42.288 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, is racily clean
10:43:42.288 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, create new FileSnapshot: lastRead=2022-04-07 10:43:42.288931000, lastModified=2022-04-07 10:43:42.285241000, size=1, fileKey=(dev=801,ino=536447)
10:43:42.289 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, isRacyClean=true, read=2022-04-07 10:43:42.288931000, lastModified=2022-04-07 10:43:42.285241000, delta=3690000 ns, racy<=2500000000 ns
10:43:42.289 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, is racily clean
10:43:42.289 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, create new FileSnapshot: lastRead=2022-04-07 10:43:42.289243000, lastModified=2022-04-07 10:43:42.285241000, size=1, fileKey=(dev=801,ino=536447)
10:43:42.289 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, isRacyClean=true, read=2022-04-07 10:43:42.289243000, lastModified=2022-04-07 10:43:42.285241000, delta=4002000 ns, racy<=2500000000 ns
10:43:42.289 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, is racily clean
10:43:42.289 DEBUG: file=/builds/HUzDdLgV/0/[MASKED]/glyngore/glyngore-context/.git/.probe-1f2735d3-e461-41c7-839c-1529688f66b2, create new FileSnapshot: lastRead=2022-04-07 10:43:42.289554000, lastModified=2022-04-07 10:43:42.285241000, size=1, fileKey=(dev=801,ino=536447)```

It seems like a bug in the scanner ?
I have attached the log also.

[sonarscanner_pipeline_log-2.txt|attachment](upload://dCGxDuNIoPDLoWAbGyO8SFE5vsj.txt) (4.0 MB)
1 Like