# SonarCloud always show no bugs, no test coverage on PRs (Github + Bitrise + Android)

**URL:** <https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424>\
**Category:** SonarQube Cloud\
**Tags:** android, github, coverage, sonarqube-cloud\
**Created:** [October 25, 2020, 7:12am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424 "2020-10-25T07:12:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [October 25, 2020, 7:12am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/1 "2020-10-25T07:12:18Z")

</div>

- ALM used (GitHub)
- CI system used (Bitrise)
- Scanner command used: Bitrise SonarQube Scanner step with configuration:

sonar.login=$SONAR\_LOGIN\_KEY  
sonar.projectKey=$PROJECT-KEY  
sonar.organization=$ORGANIZATION  
sonar.host.url=https://sonarcloud.io  
sonar.java.coveragePlugin=jacoco  
sonar.coverage.jacoco.xmlReportPaths=**/build/reports/jacoco/talabatDebug/jacoco.xml  
sonar.pullrequest.branch=$BITRISE\_GIT\_BRANCH  
sonar.pullrequest.base=$BITRISEIO\_GIT\_BRANCH\_DEST  
sonar.pullrequest.key=$BITRISE\_PULL\_REQUEST  
sonar.sources", “src/main”  
sonar.pullrequest.provider=GitHub  
sonar.pullrequest.github.repository=$REPO  
sonar.java.binaries=**/build/intermediates/javac/talabatDebug/classes  
sonar.coverage.exclusions= **/test/** , **/androidTest/** , **/R.class,** /BuildConfig._,\*\*/Manifest_._,\*\*/Test._, **/com/example/databinding/\*,** /com/example/generated/callback/_,\*\*/Dto._, **/android/databinding/\*,** /androidx/databinding/_,\*\*/di/module/_, **/_MapperImpl_.\*,** /BuildConfig._,\*\*/Component._, **/_BR_.\*,** /Manifest\*._,\*\*/Companion._, **/_Module._,** /_Dagger_._,\*\*/MembersInjector._, **/_Extensions_.\*,** /InputMethodManagerLeaks._,\*\*/_\_Factory\*._,\*\*/_\_Provide_Factory_.\*

- Languages of the repository: Java, Kotlin (Android)

- Error observed: PR decoration always show no bugs and no code coverage details

 ![Screen Shot 2020-10-25 at 11.13.46 AM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/4/e4eb4cc99801b5dd2c8d18529b20214631de38e3.png)

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [October 26, 2020, 9:28am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/2 "2020-10-26T09:28:51Z")

</div>

I need your help please. Thank you.

---

<div class="post-metadata">

**Author:** ![TomVanBraband](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tomvanbraband/32/46480_2.png) [@TomVanBraband](https://community.sonarsource.com/u/TomVanBraband)\
**Post date:** [November 2, 2020, 3:52pm UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/3 "2020-11-02T15:52:56Z")

</div>

Hello @heshambakr,

Apologies for the late reply. Did you check the logs of the scanner command? They should include some pointers as to why your code is not correctly scanned. If you can’t find anything useful feel free to share them and I’ll have a look.

Please also note that the Bitrise SonarQube Scanner is not developed by us, so we won’t be able to assist with the internals of this integration.

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 3, 2020, 6:00am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/4 "2020-11-03T06:00:52Z")

</div>

Many thanks Tom. I got approval from my company to make android minimum version 17 instead of 16. this was a blocker to use sonar cloud gradle plugin as it requires 17.

I will try again in coming days to drop bitrise step as it is not developed by you. I will use sonar gradle plugin.

I will update you if issue is solved

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 11, 2020, 11:07am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/5 "2020-11-11T11:07:13Z")

</div>

Hi @TomVanBraband I am still facing the issue even after using gradle plugin. I really need your help as we have sonarcloud but we are not benefitting from it because of this issue. I will add more information to help debug the issue. Thank you

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 11, 2020, 11:13am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/6 "2020-11-11T11:13:58Z")

</div>

Our project is multi module android project with both kotlin and java

in main gradle file, I added:

```
subprojects {
    afterEvaluate { project ->
        if (project.hasProperty('android')) {
            android {
                //other details removed for simplicity. also used x for company details

                sonarqube {
                    androidVariant "xDebug"
                    properties {
                        property "sonar.projectKey", "x"
                        property "sonar.organization", "x"
                        property "sonar.host.url", "https://sonarcloud.io/"
                        property "sonar.organization", "x"
                        property "sonar.projectKey", "x"
                        property "sonar.java.coveragePlugin", "jacoco"
                        property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir/build/reports/jacoco/xDebug/jacoco.xml"
                        property "sonar.sources", "src/main"
                        property "sonar.java.binaries", "$projectDir/build/intermediates/javac/talabatDebug/classes"
                        property "sonar.coverage.exclusions", " **/test/** , **/androidTest/** , **/R.class,** /BuildConfig.*, **/Manifest*.*,** /*Test*.*, **/com/example/databinding/*,** /com/example/generated/callback/*, **/*Dto*.*,** /android/databinding/*, **/androidx/databinding/*,** /di/module/*, **/*MapperImpl*.*,** /BuildConfig.*, **/*Component*.*,** /*BR*.*, **/Manifest*.*,** /*Companion*.*, **/*Module.*,** /*Dagger*.*, **/*MembersInjector*.*,** /*Extensions*.*, **/InputMethodManagerLeaks.*,** /*_Factory*.*,**/*_Provide*Factory*.*"
                    }
                }

            }
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 11, 2020, 11:17am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/7 "2020-11-11T11:17:21Z")

</div>

in CI, we run

`./gradlew clean jacocoTestReportXDebug jacocoTestReportMerged mergeJacocoReports`

then we run

`sonarqube -Dsonar.pullrequest.branch=$BITRISE_GIT_BRANCH -Dsonar.pullrequest.base=develop -Dsonar.pullrequest.key=$BITRISE_PULL_REQUEST -Dsonar.organization=x -Dsonar.login=$SONAR_LOGIN_KEY -Dsonar.organization=x -Dsonar.projectKey=x -Dsonar.host.url=https://sonarcloud.io/`

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 11, 2020, 11:23am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/8 "2020-11-11T11:23:21Z")

</div>

Ci succeed and in sonar cloud, you find PR. but everything is 0 and no test coverage. and in “Code” tab, there is no files

 ![Screen Shot 2020-11-11 at 3.20.56 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/7/4/74a443a0f35f9804897581eec90329641ae21452.png) ![Screen Shot 2020-11-11 at 3.21.06 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/b/a/ba5f85188ebb53e82bfd947eed71d5baabed16ac.png)

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 11, 2020, 11:27am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/9 "2020-11-11T11:27:07Z")

</div>

CI Log attached[sonar-ci\_log.txt](https://community.sonarsource.com/uploads/short-url/fUwmPDH2uBDlG2MsQDW8CaJaPiF.txt) (136.6 KB)

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 11, 2020, 11:27am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/10 "2020-11-11T11:27:38Z")

</div>

Appreciate your support. Thank you

---

<div class="post-metadata">

**Author:** ![TomVanBraband](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tomvanbraband/32/46480_2.png) [@TomVanBraband](https://community.sonarsource.com/u/TomVanBraband)\
**Post date:** [November 12, 2020, 8:54am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/11 "2020-11-12T08:54:09Z")

</div>

Hello @heshambakr,

From the logs you shared it seems that the scanner is not executing. Also on the screenshots you shared it seems that the latest analysis was done on October 21.

Did you make sure to include the `org.sonarsource.scanner.gradle:sonarqube-gradle-plugin` as a dependency?

I would also advise to seperate the properties that don’t change depending on the submodule with those that do. For example:

```auto
apply plugin: 'org.sonarqube'
sonarqube {
  properties {
    property 'sonar.projectKey', 'x'
    property "sonar.host.url", "https://sonarcloud.io/"
    property 'sonar.organization', 'x'
    property "sonar.java.coveragePlugin", "jacoco"
    property "sonar.sources", "src/main"
    property "sonar.coverage.exclusions", " **/test/** , **/androidTest/** , **/R.class,** /BuildConfig.*, **/Manifest*.*,** /*Test*.*, **/com/example/databinding/*,** /com/example/generated/callback/*, **/*Dto*.*,** /android/databinding/*, **/androidx/databinding/*,** /di/module/*, **/*MapperImpl*.*,** /BuildConfig.*, **/*Component*.*,** /*BR*.*, **/Manifest*.*,** /*Companion*.*, **/*Module.*,** /*Dagger*.*, **/*MembersInjector*.*,** /*Extensions*.*, **/InputMethodManagerLeaks.*,** /*_Factory*.*,**/*_Provide*Factory*.*"
  }
}

subprojects {
  sonarqube {
    properties {
      property 'sonar.moduleKey', project.group + ':' + project.name
      property "sonar.java.binaries", "$projectDir/build/intermediates/javac/talabatDebug/classes"
      property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir/build/reports/jacoco/xDebug/jacoco.xml"
    }
  }

```

Note that you define the `sonar.projectKey` twice in your `build.gradle` file.

> [@heshambakr](#):
>
> sonarqube -Dsonar.pullrequest.branch=$BITRISE\_GIT\_BRANCH -Dsonar.pullrequest.base=develop -Dsonar.pullrequest.key=$BITRISE\_PULL\_REQUEST -Dsonar.organization=x -Dsonar.login=$SONAR\_LOGIN\_KEY -Dsonar.organization=x -Dsonar.projectKey=x -Dsonar.host.url=[https://sonarcloud.io/](https://sonarcloud.io/)

You can also simplify this command by setting it to:

```auto
./gradlew sonarqube -Dsonar.pullrequest.key=$BITRISE_PULL_REQUEST -Dsonar.login=$SONAR_LOGIN_KEY

```

No need to repeat the properties that are already set in the `build.gradle` file.

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 12, 2020, 12:49pm UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/12 "2020-11-12T12:49:00Z")

</div>

@TomVanBraband yes I depend on plugin  
classpath “org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1”

and it is working on develop (screenshot attached) see the date. also I attached a screenshot of new pr (see date) .

the command I use in case of branch with PR (eg develop):  
`./gradlew sonarqube -Dsonar.branch.name=$BITRISE_GIT_BRANCH -Dsonar.organization=talabat-dhme -Dsonar.login=$SONAR_LOGIN_KEY -Dsonar.organization=talabat-dhme -Dsonar.projectKey=talabat-dhme_TalabatAndroid -Dsonar.host.url=https://sonarcloud.io/`

What I don’t understand, how it works with develop but doesnt work with PR. also sonarcloud knows adds PR to dashboard. but doesn’t see files

 ![Screen Shot 2020-11-12 at 4.41.36 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/3/8/380a18b6209b09b822239b08902b3deb4afaec66.png) ![Screen Shot 2020-11-12 at 4.42.22 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/3/e37b6944686e84b0d5bceca4e2f82968f444f26d.png)

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 12, 2020, 12:55pm UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/13 "2020-11-12T12:55:31Z")

</div>

@TomVanBraband These are the CI logs for branch (develop) pipeline that works and PR pipeline that has the issue

[sonar\_branch\_develop\_log.txt](https://community.sonarsource.com/uploads/short-url/3i1s2dUOAE2FCaCMnvQZHpvpQ69.txt) (139.6 KB) [sonar\_pr\_log.txt](https://community.sonarsource.com/uploads/short-url/pvuK3RLYWrFPoGgLSkh6xTt6zFS.txt) (140.0 KB)

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 17, 2020, 6:37am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/14 "2020-11-17T06:37:28Z")

</div>

@TomVanBraband appreciate your support. You know how hard to have sonar-cloud for long time without being able to use it. I am sure it is related to the arguments passed to the plugin as removing pr related arguments reports develop branch without issues.

Is there a way we can have quick call so I can show you the problem. or may be logs I shared is enough for you know the issue

---

<div class="post-metadata">

**Author:** ![TomVanBraband](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tomvanbraband/32/46480_2.png) [@TomVanBraband](https://community.sonarsource.com/u/TomVanBraband)\
**Post date:** [November 17, 2020, 10:39am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/15 "2020-11-17T10:39:31Z")

</div>

Hello @heshambakr,

Sorry for the delay in getting back to you. Could you share the log output of `./gradlew sonarqube ... --info` for both a branch and PR analysis? That should give more useful information.

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 19, 2020, 11:18am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/16 "2020-11-19T11:18:07Z")

</div>

Hi @TomVanBraband  
Here are [develop branch log](https://drive.google.com/file/d/1N_LlTNiR1bNBQKjcdyAGW0p9ahOE9zHa/view?usp=sharing), [one of features branch](https://drive.google.com/file/d/1qy333SiywtkyBEnAfJQSk7fGTdhb9vtk/view?usp=sharing) log and [its PR log](https://drive.google.com/file/d/15vEcw7uSFiONa-W8yzdH0r6ocbVds1u5/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![TomVanBraband](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tomvanbraband/32/46480_2.png) [@TomVanBraband](https://community.sonarsource.com/u/TomVanBraband)\
**Post date:** [November 20, 2020, 7:15am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/17 "2020-11-20T07:15:42Z")

</div>

Hi @heshambakr,

Everything looks fine in those logs.

However for PRs we only show results on code that was changed in the PR, we don’t show all results like we do for your default branch. This is to allow developers to focus on improving the new code they add to a project and to not be overwhelmed by results on older code.

Could this be the case for you? Could it be that you didn’t any new code in the PR you are scanning (or that the new code you added is excluded from analysis by the `sonar.exclusions` parameter)?

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 21, 2020, 12:45pm UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/18 "2020-11-21T12:45:12Z")

</div>

@TomVanBraband no. I gave misleading PR. All PRs give 0.  
I created another branch and its pr with violations in both kotlin and java including un tested code and removed `sonar.exclusions` parameter from configuration

in this post: [branch log](https://drive.google.com/file/d/1EfDuW0Y7z9xUk9euR4fXDWOQurKy9luD/view?usp=sharing), screenshots

 ![Screen Shot 2020-11-21 at 4.35.15 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/6/b/6b55335f9753108cba0457f246455d18d3338541.png) ![Screen Shot 2020-11-21 at 4.35.33 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/6/9/69d5d665f056ad029e9cddb77e5486e1b269dc5d.png) ![Screen Shot 2020-11-21 at 4.35.50 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/2/7/27b757b09d4e0fdb0724a2172027b6ec1a690445.png)

as you see, although sonar knows that code is not covered with test, it doesn’t show code coverage info in overview.

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 21, 2020, 12:49pm UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/19 "2020-11-21T12:49:08Z")

</div>

[PR log](https://drive.google.com/file/d/1xNgfzsZLS4OSN8VxVXpvIMldL6gMqrh_/view?usp=sharing). screenshots:  
As you see, no info at all and no files

 ![Screen Shot 2020-11-21 at 4.46.49 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/f/6/f6f63ebec682fd6d528168b02d02b963267d00e6.png) ![Screen Shot 2020-11-21 at 4.47.02 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/f/f/ff5156d33109fb2082ed35d442a8c83017fe3735.png)

I wish this time we find the issue.

If you wish, please lets have a quick call: [hesham.bakr@talabat.com](mailto:hesham.bakr@talabat.com)

Thank you

---

<div class="post-metadata">

**Author:** ![heshambakr](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/heshambakr/32/17114_2.png) [@heshambakr](https://community.sonarsource.com/u/heshambakr)\
**Post date:** [November 25, 2020, 11:36am UTC](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424/20 "2020-11-25T11:36:01Z")

</div>

@TomVanBraband did you observe any issue in logs ?

[Next page](https://community.sonarsource.com/t/sonarcloud-always-show-no-bugs-no-test-coverage-on-prs-github-bitrise-android/33424.md?page=2)
