I used to be able to see the code coverage for all my files in the branch (develop) but recently I only see the coverage on new files. Some parts are developed a year ago and I want to see which lines/statements aren’t fully covered yet. How do I get back the code coverage on all files? I just can’t find it in the UI and the “New Code” thing seems forced up on me while I don’t want to use it on this project (yet).
Hi,
Welcome to the community!
By default you land on the New Code tab now, but there’s also an Overall tab, which will give you the high-level metrics you seek. Or you can jump straight into Measures, which shows different metrics for new and overall.
HTH,
Ann
Hi, thanks for your reply. That’s the whole problem, there is no such thing as “Overall” anymore. The Measures only shows the Coverage of New. No tabs are available at all to choose from.
Hi,
It sounds like you’re looking at either a PR or a short-lived branch. Because Overall is certainly there for me:
Ann
As mentioned, I’m on “developed” which is considered a short-lived branch but since there is no stable version yet, it must be on develop. It always used to work fine but suddenly this stopped working, most likely due to changes in how Sonarcloud works. I want to get back the old functionality as it’s the main reason for using this product.
Hi,
I can’t comment on what you used to see, but SonarCloud functionality has not changed with regard to short-lived branches. Short-lived branches have always been about new code. If you’d like to see overall values for your branch, you’ll need to delete it, and re-create it as a long-lived branch.
Ann
It has changed for sure since this is the only branch I have and until a few weeks ago, it was always showing the Overall code coverage just fine as this is how I could see what is unit tested and what not.
How can I mark the branch as long lived? The UI isn’t clear at all.
Hi,
Once a branch is created, its type cannot be changed. As I said,
HTH,
Ann
But how does it change from short lived to long lived after it’s deleted and recreated? Can you point me to some documentation?
Hi,
Fair question & sorry I didn’t point you to that proactively. This is about your long-lived branch pattern.
If you go to Branches, you should be able to edit the pattern at the top-right of the page.
This is a regex, so you can cover a lot of ground with it, but if you’re only working with “developed” then you could just set it to that.
Ann
Thank you, I will give this a try. It’s still strange though that I have used SonarCloud for a year without this issue.
I’ve updated the regex to match the “develop” branch, deleted the “develop” branch and now it’s back to normal behavior as I had for the past year. I needed a second scan before it passed though.