# Sonarqube showing 0% code coverage for python

**URL:** <https://community.sonarsource.com/t/sonarqube-showing-0-code-coverage-for-python/76250>\
**Category:** SonarQube Server / Community Build\
**Tags:** coverage\
**Created:** [November 17, 2022, 6:59pm UTC](https://community.sonarsource.com/t/sonarqube-showing-0-code-coverage-for-python/76250 "2022-11-17T18:59:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Utkarsh\_Rai](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/utkarsh_rai/32/29350_2.png) [@Utkarsh\_Rai](https://community.sonarsource.com/u/Utkarsh_Rai)\
**Post date:** [November 17, 2022, 6:59pm UTC](https://community.sonarsource.com/t/sonarqube-showing-0-code-coverage-for-python/76250/1 "2022-11-17T18:59:49Z")

</div>

Using-

- SonarQube- Developer Edition Version 9.3
- Tox with travis CI
- python coverage.py to generate coverage.xml  
I have been assigned to integrate Sonarqube into one of my company’s python repo and I know there are similar thread to this but none of them resolved my problem so here I am pasting all the things that I have done so far. we have been using travis CI with tox for test coverage for long, so using its coverage.xml for sonar-scanner’s -Dsonar.python.coverage.reportPaths I will be attaching the screenshot of logs where its show that scanner is reading and uploading this file. I am using command line to define its property
  - sonar-scanner -Dsonar.projectKey=$SONAR\_PROJECT -Dsonar.sources=src -Dsonar.host.url=$SONAR\_URL -Dsonar.login=$SONAR\_LOGIN -Dsonar.python.coverage.reportPaths=src/coverage.xml -Dsonar.verbose=true  
 ![Screenshot 2022-11-18 at 12.27.23 AM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/3/2/3278a5f6d51c62cfdc8ae1243ec4fdc288f46e46.png)  
 ![Screenshot 2022-11-18 at 12.27.48 AM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/0/4/04afa57f74af15ddeaa906da9c9b45071af222c6.png)  
 ![Screenshot 2022-11-18 at 12.30.51 AM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/f/a/fac16dcf5d6296e09781a8150ed5fd9787e35ad7.png)

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [November 18, 2022, 5:39pm UTC](https://community.sonarsource.com/t/sonarqube-showing-0-code-coverage-for-python/76250/2 "2022-11-18T17:39:01Z")

</div>

Hi,

Welcome to the community!

There’s a big gap in what you’ve provided from your analysis report. What happens after analysis finds the coverage report? Anything about it’s processing? Any errors?

Can you add `-Dsonar.log.level=DEBUG` to the analysis command line and copy/paste the full text of the analysis log?

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![nskmda](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nskmda/32/39973_2.png) [@nskmda](https://community.sonarsource.com/u/nskmda)\
**Post date:** [December 10, 2022, 11:47pm UTC](https://community.sonarsource.com/t/sonarqube-showing-0-code-coverage-for-python/76250/3 "2022-12-10T23:47:40Z")

</div>

Utkarsh,

I got the same assignment and having a similar issue.

Which tool are you using?  
I’m using Gradle SonarQube plugin and i don’t see any specific report processing-related output in the console after running the `sonar` Gradle task.

But I’m effectively having the save issue at the end of the day: SonarCloud server shows no code and no coverage for my project.

One difference (probably) is that my company is primarily a Java shop and the project created in Sonar was probably using some ‘default’ (Java-related maybe?) configuration.

G Ann

Can you please let me know for Sonar projects (on the server side) some configuration might need to be chaged in a case like mine?

I’m trying to stick to ‘classic’ (Maven/Gradle) source code folder structure (like src/main/python, src/test/python). Maybe the Sonar project config needs to be adjusted to use the `python` subfolder for the coverage?  
I’m not an admin and can’t check the project settings and don’t even see anything related to source paths and such in the UI (or maybe I just can’t find them?).  
I know the coverage XML file is generated and `sonar` Gradle plugin doesn’t report any errors when I run it (so, hopefully, during the build the report gets discovered and uploaded to the server).

But still Sonar server doesn’t show any source files nor code coverage after I successfully run Gradle build.

Any suggestions before I turn to my Sonar admin?

---

<div class="post-metadata">

**Author:** ![Utkarsh\_Rai](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/utkarsh_rai/32/29350_2.png) [@Utkarsh\_Rai](https://community.sonarsource.com/u/Utkarsh_Rai)\
**Post date:** [December 12, 2022, 10:39am UTC](https://community.sonarsource.com/t/sonarqube-showing-0-code-coverage-for-python/76250/4 "2022-12-12T10:39:26Z")

</div>

Thanks, Ann for replying but it get resolved by doing a hit and trial

---

<div class="post-metadata">

**Author:** ![Utkarsh\_Rai](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/utkarsh_rai/32/29350_2.png) [@Utkarsh\_Rai](https://community.sonarsource.com/u/Utkarsh_Rai)\
**Post date:** [December 12, 2022, 10:48am UTC](https://community.sonarsource.com/t/sonarqube-showing-0-code-coverage-for-python/76250/5 "2022-12-12T10:48:16Z")

</div>

Hey,  
I am using Travis CI with tox for sonarqube integration and generating a coverage report which get passed to the sonarqube.  
if you are also able to generate and pass the report to sonarqube successfully then remember this coverage metric only gets shown when any new code gets added to the PR
