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

kind reminder @TomVanBraband

Hello @heshambakr,

Apologies for the late response. The problem is most likely that not enough git history is being fetched. The scanner relies on the data it can find in the git history to decide what is new code in a PR and what is not. This explains why it works for you an branches (everything is scanned anyway) and not on PRs (only new code is scanned, but we canā€™t find any new code).

I assume you have been using the git-clone step, this optimizes the git clone step to be as fast as possible. I canā€™t find much documentation on this step, but it might be worth to try setting the clone_depth or the branch_dest parameter to see if this changes the behaviour.

In the worst case you can do a manual git clone, like this user did.

@TomVanBraband Yes We are using git-clone step .
clone_depth is not set which means it gets whole history so it should work
branch_dest is set to dynamic value: $BITRISEIO_GIT_BRANCH_DEST
I checked the post you shared, he didnā€™t mention clearly how to solve problem

@TomVanBraband I started to give up :slight_smile:

I created a hello world app

https://github.com/hishambakr/SonarCloudDemoAndroid

and hello bitrise flow and replaced clone step with a script

git clone git@github.com:hishambakr/SonarCloudDemoAndroid.git /bitrise/src

and still PR has no files on sonar

I didnā€™t face these issues when I integrated codecov for exmple with bitrise

@TomVanBraband Finally issue solved
I think we should write a blog post about it or add it to documentation

the solution is to remove bitrise git clone step and instead use script to clone

In last trial, I forgot to add branch to the script. so right script example is:

git clone -b $BITRISE_GIT_BRANCH git@github.com:hishambakr/SonarCloudDemoAndroid.git /bitrise/src

Thank you @TomVanBraband fo the support

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.