PullRequest Analysis always return no issues


(Miquel Labòria) #1

We are integrating Pull Request in Github and always return no issues:

In SonarCloud the PR appears but don’t show any code:

I’m revising all the documentation and I can’t see what’s wrong…


(Fabrice Bellingard) #2

Can you please clarify your context?

  • Which languages is your project using?
  • How do you trigger the analysis? (which CI service? using a SonarCloud integration?)

(Hauke) #3

Interestingly we have the same behaviour since about 2 days ago.

We are using Sonarcloud and the Bitbucket Pipeline Integration. While this is not Github, which Miquel Labòria is using, we do have the same result. The Sonar call creates an analysis reports and pushes the information succesfully to sonarcloud (the report processing task is successful). But there are simply no code changes to be found in the analysis linked to the Pull Request.

The call is done like this:

mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=... -Dsonar.organization=... -Dsonar.login=$SONAR_TOKEN

Interestingly the code changes for the short lived branches are still recognized correctly until a Pull Request is created.

If I trigger a code analysis manually via

mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=... -Dsonar.organization=... -Dsonar.login=... -Dsonar.pullrequest.base=develop -Dsonar.verbose=true -Dsonar.pullrequest.branch=... -Dsonar.pullrequest.key=671 -Dsonar.pullrequest.provider=bitbucketcloud -Dsonar.pullrequest.bitbucketcloud.owner=... -Dsonar.pullrequest.bitbucketcloud.repository=...

it is added correctly to the Pull Request and we can see code changes. But while doing so I do get a warning grafik
This does not make sense, as the SonarCloud application is already correctly bound. (I can’t attach a screen of this unfortunately as I am not allowed to do so)

There are multiple languages used including Java, Kotlin, Typescript.

PS: If this should be in a different ticket, I gladly create a separate one. Nonetheless the error behaviour is so similar so I added this her for now.

Edit: We no longer see code changes while triggering it manually, yet the warning remains and the activity is still updated.

(Miquel Labòria) #4

We use:

  • Swift & Objective-C on a project
  • Java & Kotlin in an other

We trigger the analysis via Bitrise.io and use an script with the parameters

(Hauke) #5

Hi @Fabrice_Bellingard Did you have time to look into this? Is there any information you are still missing?

(Fabrice Bellingard) #6

@hauke Can you please open a new thread? The behaviour might look the same but the environments are different. Thanks.

(Fabrice Bellingard) #7

@miquellaboria Thanks for the answer. Since you see the PR inside SonarCloud, and you see the “Successful” status at the bottom of the GitHub PR, this tends to show that the analyses are correctly configured.

Now, can you create a PR with just a very simple issue, like for instance adding a TODO in a file:

func doSomething() {
  // TODO

(Miquel Labòria) #8

Finally we solved.

The problem was Bitrise make the git clone on the base branch and do a merge in it. Sonar then can find any differences between branches and can’t check code.

Now we do the checkout manually and the validation works fine.

Thank you!

(Fabrice Bellingard) #9

Thanks for explaining the situation @miquellaboria!

(Teo Boon Keat) #10

Hi having some problems with this also. I understand the problem but not the solution. So did you add a script step in the Bitrise workflow to checkout back your pull request branch? Before running the sonar scanner?