Change the root of branches in Sonar Cloud

Hi guys.
I am trying to change the root of branches that are analysed by Sonar Cloud. Right now I have the following structure:
first

I wanted to change it with the following one:
second

I am using AzureDevops pipelines for configuration.
Any advise could help.
Thank you.

Hi @AlinD

If you go to the Administration menu of your project, then click on “Branches and Pull request”, you’ll have the line where your master branch is displayed. On the very right, 3 verticals dots gives you a contextual menu, you should be able to rename your branch there.

HTH,
Mickaël

Hi Mickaël
Thank you. But I don’t want just to rename the branch. I want to change the source of the branch.

Ok then in the same menu, you should be able to change your develop branch as the default branch, is that what you need ? You can them remove master if you don’t need it anymore. (And don’t forget to update the Long living branch pattern on the top right corner to remove develop if it’s on it.

HTH,

Please take a look at my screenshot, because it is not entirely clear for me:

Should I change this part (branch|release)-.*?

Yeah sorry,

So i think my first thought was right :
If you want that develop branch to be the main branch, then just delete that branch on SonarCloud, and rename the master branch to develop, no need to touch anything on the Long living branch pattern.

Thank you. I did in that way but after I analysed the main branch i got this error: ##[error][SQ] Task failed with status FAILED, Error message: This analysis will make your organization ‘psaformsp-bitbucket’ to reach the maximum allowed lines limit (having 566504 lines).

As can be seen in the screenshot, the main branch failed and the others passed. Also it looks like it wasn’t analysed from last year. Honestly I don’t undestand how it is working. I am using Azure pipelines to do the analysis. I also created a separate Azure Pipeline for the main branch with the same settings as the others that passed.

That could make sense that a branch not analyzed since one year got many new LOCs so that this message is displayed. Could you try figure out if the analysis is processing maybe too many files as per your wish ?

Mickaël

How can I see that? Is it a place where I can check what files are selected for analysis?
Or maybe, how can I start a new analysis? So, I will clean all the branches and start a new analysis for the main branch. Is it possible?

You have a “Code” tab on your project’s dashboard, you can see the computed LOCs for each folder/package

Best would be to drop the branch on SonarCloud, then re-run an analysis on it.

Mickael/Whomever Else It May Concern,

I have to hope you will see this as I have to admit I am super confused here.

In Alin’s scenario, you are saying to delete the develop branch (containing new commits possibly) and rename the master branch (lacking those commits) to develop. If we then run a build in azure devops, will the new commits be sent to Sonar, and be available in the develop branch?