SonarQube not generated a report with 'The main branch has no line of code'

Hi All,

I am trying to generate a SonarQube report for an iOs mobile app and I keep getting ‘The main branch has no line of code’ when I am running the SonarScanner command.

The branch I used to check out the code from Git used to be called ‘main’. I have created a ‘master’ branch. But this didn’t solve the issue.

Renaming the branch from ‘main’ to ‘master’ is the only viable solution I can think of as I have setup everything correctly.

After extensive research on Google, it seems a common issue but no one has really found a fix.

Can anyone please advise?

Many thanks,

Ionic

Hi Ionic,

Welcome to the community!

I guess your analysis shows up in SonarQube as a non-main branch?

Is the branch in question the project’s default branch? Because we’ve done work on treating the default branch as the main one for SonarQube 9.8 (E.T.A. 12 Dec).

 
Ann

Hi Ann,

I don’t think this branch is the default one.

I did think it looks like SonarQube is expecting the branch name to be called ‘master’.

If you can help set the branch as default or anything else, that would help.

Many thanks,

Ionic

Hi Ionic,

What’s the name of the branch you’ve analyzed? Also, what’s your version of SonarQube?

 
Ann

Hi Ann,

The branch name is ‘master’ and the version of SonarScanner is 4.7.0.2747

Thanks,

Ionic

Hi Ionic,

What’s your version of SonarQube? You can find it in the page footer.

 
Ann

Hi Ann,

Version 9.5 (build 56709)

Ionic

Hi Ann,

Can you please advise? I need to run this SonarQube report today.

Many thanks,

Ionic

Hi,

Can you share your analysis log?

 
Ann