Getting "The main branch has no lines of code." In a TypeScript Project added With Github

Hi Guys, I have an issue with SonarCloud and a project that was added through GitHub.

  • ALM used (GitHub)
  • CI system used (Sonar Cloud Analyzer BETA)
  • TypeScript
  • It’s a private project.
  • I’m seeing this in the project overview tab even though there is code to analyze:The main branch has no lines of code.
  • I added the project with the steps specified in SonarCloud Portal, nothing more, nothing less.
  • There is no workaround as far as I know, I tried navigating all the views in SonarCloud looking for a way to fix this issue but none of the possible options sounds like it would fix it.
  • I set sonar.sources to my source folder like this sonar.sources=src/I know this worked because now I’m seeing only that folder in the code tab but still the message about the main branch is there and in the code tab it cannot find any LOC (when clearly, there are LOC).
  • I have other TypeScript projects which are working, I don’t see important difference between those and the one that’s not being analyze properly.

Any help is appreciated.


Hello Joseph!

And welcome to the community forum!

Seeing your message I wonder if only a PR of your project gets analyzed ? So you would not see anything on your main branch.
When you go on your project page on SonarCloud, what do you see in this menu :

Do you have a PR that has been analyzed ? If yes that means you will just need to merge it on your main branch to get it analyzed too and all your future PR that you will create from this main branch.