I have tried to follow the guideline (Python Test Coverage | SonarCloud Docs) to set up the coverage test in azure pipeline but the coverage is still 0%
I saw below error message and google for a long time but still can not fix it…
WARN: No report was found for sonar.python.coverage.reportPaths using pattern coverage.xml
INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=19ms
INFO: Sensor PythonXUnitSensor [python]
INFO: Sensor PythonXUnitSensor [python] (done) | time=9ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=4ms
INFO: Sensor JavaScript inside YAML analysis [javascript]
INFO: Deploying custom rules bundle jar:file:/home/vsts/.sonar/cache/ce591e3f7610860294db52053899e90f/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules3024934604809391150
INFO: 1 source file to be analyzed
I have tried to see other public code scan as a reference but seems like that most of them do not have the yml file or ini file. So I am interested is there any other way to set up the coverage for code scan - python
I am following the sonarcloud official sample to set up but I think that is with github and for my case, I am using azure devops so there may have some difference ?
Below is the structure of my code~
Since I am not sure where to put the test.py file. so I have tried to put it in the root and also inside tests folder
Sorry I am not too sure what you mean, you mean we need to define a place for export report ?
I thought the properties file has defined the report path ==> create coverage.xml in the root
So, the error from the OP correlates to the path you’re providing in sonar-project.properties.
So the question is, where is the coverage.xml file, relative to where analysis is launched from? Is it in the directory you’re in before you invoke the SonarScanner?