Getting the error "The main branch of this project is empty." when running sonarqube analysis through Azure Devops CI pipeline

Hi All ,
I am using Sonarqube Community ver : 8.9.6
and I am trying to Run code analysis via Azure Devops CI pipeline.
I am getting the error “The main branch of this project is empty.”

I have set up this analysis for several pipelines, all is working fine except one where I get this error.
All other pipelines are also using same Sonarqube and Azure.

Can you please give me some idea what could cause this issue and how to resolve it ?

Hi,

We show this message when there’s no ncloc measured on the main branch. If you

  • click through to the project homepage
  • go to the measures tab
  • expand the Size list

… what do you see?

E.G.
Selection_033

Also, what languages are in your project?

 
Ann

The language of the project is C# . The size shows nothing.

image

Hi,

What about the other size measures?

 
Ann

Hi Ann,

I am attaching below other measures and project setting.

One more thing I noticed from Activity is the analysis was showing some results till August 17,2021 and it shows nothing on Dec 10,2021 analysis. There’s no change committed between Aug 17 and Dec 10, 2021. What could possibly cause this ?




Thanks !

Hi,

You’ve already shown me that there are 0 New Lines. I was asking about the other measures in the Size domain, not the values in the other domains.

I sent you a screenshot showing

  • New Lines
  • Lines of Code
  • Lines
  • Statements
    &etc.

Can you show me those values for your project?

 
Ann

Hi ,
here’s all the details in size domain :

Regards,
Rehan

Hi Rehan,

What language are we talking about? And are you using a 3rd-party plugin to analyze it? It looks like the expected size metrics simply aren’t being provided for your project. And the UI relies on seeing a non-zero ncloc (non-comment lines of code) value to know that there’s something to display for the project.

 
Ann

Hi Ann,

I can see the below warnings, why is considering my project as test-code, can i explicitly set it as Main code?
The language is C# , quality profile sonar-way(C#)
image

image

Regards,
Rehan

Hi Rehan,

That second warning is the problem. This may help:

 
Ann