You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I was looking into how to visualize code coverage from a `.lcov` file into Bitbucket PRs. I found this extension but it's for Server only.
Is there any plan to have a Cloud version of the extension or is there any other solution that doesn't involve third-party providers?
I'm using `coverage.py` to generate reports, so I can easily output them in other common formats as well.
Hi Matteo and welcome to the community!
We provide an API endpoint for creating reports that can include code coverage information. Reports generated with this API endpoint are going to be displayed on the Reports panel of a pull request (on the right-hand sidebar). The report needs to be created for the last commit of the source branch of a pull request.
This is the API endpoint for creating reports:
You can also create annotations for each report using the following endpoint:
If you're using Pipelines for CI/CD, you can write a pipe that generates these reports, if not, you can write a script that uses our API to generate these reports.
You can also check the following documentation page for more information:
I want to ask you about BITBUCKET CLOUD:
What would be desired way for Report Annotation to become code coverage and be represented as color-coded blocks, telling us which lines of code are covered with tests. (Fully, Partially, or Not covered)
Exactly as in CODE COVERAGE section of Bitbucket Server documentation: https://confluence.atlassian.com/bitbucketserver/code-insights-966660485.html
Does Bitbucket cloud have THIS inbuilt option (like annotations enabled. Other way would be styling annotations),
Or do I have to create an Connector App / BB Cloud Plugin, to get to the interfaces Which is not ideal. That would require a lot of work and create the need to put entire workspace in the development mode or wait for the approval correct ? (also is there a way to develop Private repository app)?
Annotations are displayed in the pull request diff (after they are created with our API). If you're using Pipelines you could write a pipe that creates reports and annotations, otherwise, you would need to create a plugin that does that. If you have any questions about creating a plugin you can reach out to the developer community here: https://community.developer.atlassian.com/c/bitbucket-development/bitbucket-cloud/13
Showing code coverage as color-coded blocks is not possible at the moment, because annotations can be created for a single line only. We would need to extend our annotations API endpoint to include a from field to indicate which lines are covered by the annotation.
I went ahead and created a feature request about this in our issue tracker that you can vote for to express your interest:
Thank you for your answer Theodora.
Altho I Do you think that adding multi line annotations would enable us to achieve the desired outcome I've posted above?
Wouldn't adding annotation_type: (like coverage) and some magic on your side be the solution?
Also (I didn't get into that a lot, But), To create the desired plugin I would need to refer to some of your modules interfaces. Do you think those values would be sufficient to do what I want to achieve (aka. show code coverage as color-coded block)
On the Bitbucket Server solution you have CONTEXT and refer to fileContext AND Bitbucket Server web resource contexts (that I would need to achieve in mine Bitbucket CLOUD)
You are right, I adjusted the feature request so that it doesn't focus on the multi-line part of the annotations only, and so that the desired outcome is more clear. Please make sure to add your vote as well by selecting the Vote for this issue link in that feature request, as the number of votes helps the development team and product managers better understand the demand for new features.
Regarding your other question, I am not very familiar with the module interfaces as I haven't been involved in plugin development, I would suggest asking your question in the developer community here https://community.developer.atlassian.com/c/bitbucket-development/bitbucket-cloud/13.
Hi @zygmunt_buszyk, thank you for catching up on my request, you covered exactly what I was interested in!
Thank you @Theodora Boudale for creating the feature request. Am I understanding correctly that this would provide an endpoint to upload a `.lcov` file from Bitbucket Pipelines and have colored code-blocks in the PR automatically? Or would an extra step be needed?
The feature request was focused more on providing API endpoints that will help with showing code coverage information. Even when the endpoints are provided, an integration would need to be built using those API endpoints.
I have added the requirement to provide the option to upload the coverage file in Bitbucket Cloud, so that you won't need to build an integration yourself.