Divergent results between Pipeline and Pull Request

Hi, I need help about structure Azure Devops x Sonar Cloud.
In my structure we used Sonar Cloud to analise code and your functions always met my expectations but in a project something strange happened.
What appears as a result of the analysis for view Pipeline is different from what appears as a result in view Pull Request.
Could you explain this difference if possible?

Hi Mauri,

Welcome to the community!

It’s a bit difficult to tell from your screenshots but if you are talking about the fact that your PR quality gate passed but your main branch quality gate did not, then this is certainly possible.

The PR analysis only reports issues that arise in the PR itself and the quality gate used for the PR analysis only applies its “new code” conditions to determine whether the analysis passes or fails.

On the other hand, the main branch analysis reports all issues on the main branch, and the quality gate used there can (if so configured) apply issues on “new code” and issues on “overall code”

The result is that the quality gate calculations on any given analysis of the main branch and any given PR can certainly diverge.

If you want to dive into the details you can look here: https://sonarcloud.io/documentation/improving/overview/