Sonarqube -The main branch of this project is empty

I’m trying to get the sonaranalysis report for my .NET code. But getting like “The main branch of this project is empty”.

I’m using SonarQube community edition 9.9 and my code is in develop branch. I can see the code of develop branch getting uploaded in the ‘Code’ section in sonarqube portal, but still it shows main branch is empty and no details regarding bugs, code smells etc.

I have correctly configured sonar.sources and sonar.tests paths.

What’s the issue here? Could someone please help?

@White near to your project name there will be showing the default branch name probably it will be main branch. if your code is analyzed with develop branch click on dropdown and and select develop branch it will show the details.

1 Like

There’s no dropdown to select the branch in Community Edition. In Developer and higher editions only there’s that option right?

I am using Enterprise edition so not sure about the community edition

Hi,

No, there’s no dropdown in Community Edition.

@White can you share your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hey, sorry but can’t provide the logs since it contains client specific stuff.

But I don’t think it’s because of wrong branch.
My analysis is getting successful, even I can see the code getting uploaded under the code section of sonarqube. But for some reason it says that 'the main branch is empty 'and am not able to see the issues like bugs, vulnerabilities, coverage etc.

Could you suggest me some things that I should verify in case of such issue?

Hi,

You can redact the logs as necessary.

What language is under analysis? You’ve said this is “.NET code”, but specifically what language and/or project types?

When you see your files in the Code tab, are the metrics populated for them? Maybe share a screenshot, redacted as necessary?

 
Ann

It is fixed now, thanks anyway.

@White could you please share how you fixed this

I was providing custom source code and test files path using sonar.sources and sonar.tests, maybe sonar scanner wasn’t able to pick the reports. I removed both those sonar properties, now the sonar scanner automatically picks the correct path for sources and tests and ‘the main branch is empty’ issue is fixed.

2 Likes