Sonar Cloud Widget on Atlassian Bitbucket Cloud Pull Request shows Green Albeit Code Quality is in Error


(Nico) #1

In normal operations, as long as there are some code-smells, the widget shows like:

And then when the code-smells are fixed and the Code Quality analysis updates the widget, it becomes green.

… second screenshot missing due to insufficient rights …

However this also happens even if the code-coverage percentage value is below the value we have configured in the project (here it is high with nearly 100%, the limit we have is 80% for error and if it is 73% for example, it still shows green).

My first question would be if this is the standard behaviour (green build despite code coverage percentage is too low (error)).


(Benoit) #2

Yes, it the standard behavior. Currently the Quality Gate on PR is hard-coded to “no open issue”.
So the only thing that makes the PR status green or red is whether or not you have open issues.

We know it’s not an optimal solution, and we plan to provide custom quality gate on PR. It’s on our radar for this year (probably first half).
You can find more details about the feature here MMF-1369.


Code Coverage issue with Pull requests
(Nico) #3

@benoit: Thanks for the fast clarification, this helps a lot. Could you be so kind and give me a short hint if it is possible to use some HTTP based API (from Atlassian Bitbucket Cloud Pipelines -> Sonar Cloud) to check for progress of an analysis (sheduled, running and done I guess) so after the agent runs through we could gather this data with some glue code and make it fail hard as we like it? My knowlege about Sonar Cloud is very limited, so some references to API docs etc. would give me some jump-start. Thanks again!


(Benoit) #4

You can find the documentation about our web api on https://sonarcloud.io/web_api/.
What you looking for is probably https://sonarcloud.io/web_api/api/ce.