Hi Sonar Community,
I notice the Percentage Number of Code Coverage in Azure DevOps (Cobertura) is not same/equal Percentage Number in SonarCloud Coverage.
Azure DevOps: 90%
May i know why is that ?
python -m pytest -v --cov=service --cov-report=xml:coverage-reports/coverage.xml --cov-branch --cov-fail-under=70 --cov-report=term-missing test
Please note: I didn’t scan yet the
main branch in sonarcloud.
Once you’ve scanned your main branch, you should be able to see the Code tab (including all files analyzed, which this “estimated after merge” figure represents) and understand what files are being included in this figure.
I think this will help you understand what could be the source of the discrepancy. For example – SonarCloud includes all files in the coverage calculation that have “executable lines” – not just the ones included in a coverage report. If you have a mixed-language project, that could be the source.
Noted, i thought the code coverage value is from the
coverage.xml, but that is not the case.
How could i make SonarCloud to only calculate Coverage in folder
/service, and i still want sonar to scan all file & directory but exclude the coverage. - Is this possible ?
The Analysis Scope documentation should help you understand how you can exclude certain files from coverage (unfortunately, only exclusions are possible, not inclusions)
Thank you @Colin , that is helpful link
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.