The main branch is not getting analyzed using Automatic Analysis

I am trying to auto analyze a typescript project using the new Automatic Analysis Beta Feature. However, I am unable to analyze my project.


  • Analysing the typescript project in GitHub repository.
  • The project was created by selecting the repository in SonarCloud and is bound to GitHub
  • Added file to the default branch (dev) in GitHub.
  • But after the analysis, The main branch has no lines of code. gets displayed
  • I have also renamed the default branch to dev in sonarcloud

However, each pull request gets analyzed without any issues. Below is the sonarcloud properties file.
Also, I have used Automatic Analysis for other type of projects and that works without any issues.

# Path to sources
# Path to tests
# Source encoding
# Exclusions for copy-paste detection

Welcome to the community!

Can you please clarify the following:

  • What is the default branch of the project…
    • … on GitHub
    • … and on SonarCloud
  • If you push a commit to this branch, then “The main branch has no lines of code” message should disappear, and you should see the analysis results. Does that not work?
  • Is your project public? (If yes, please share the link!)
  • “However, each pull request gets analyzed without any issues.” -> do you mean that you expect to see issues but it’s not happening? If that’s the case, please share an example that should be reported as an issue, but it isn’t.

Thanks Janos. Below are the details:

  • The default branch on GitHub and SonarCloud is dev.
  • If a commit is pushed to the default branch, then we still get “The main branch has no lines of code” message.
  • The project is not public
  • When a PR gets generated, the code analysis is done and it comes under Pull Request section. What I mean by this is that when a PR gets generated then I dont see the “The main branch has no lines of code” message.

Just now a new PR was raised and got merged into dev branch and that resolved the issue. However, I wonder why was the code not analyzed initially.

At the time of this writing, activating Autoscan does not trigger any analysis. Analysis is triggered by new commits pushed to GitHub, after the activation. (An improvement to this behavior is coming soon.)