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.

Details:

  • Analysing the typescript project in GitHub repository.
  • The project was created by selecting the repository in SonarCloud and is bound to GitHub
  • Added .sonarcloud.properties 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
sonar.sources=src
#sonar.exclusions=packages/migrations/**,**/ext/**,api-docs/**,**/dist/**
#sonar.inclusions=packages/**/src/**
# Path to tests
#sonar.tests=.
#sonar.test.exclusions=
#sonar.test.inclusions=packages/**/src/__tests__/**,extensions/**/src/__tests__/**
# Source encoding
sonar.sourceEncoding=UTF-8
# Exclusions for copy-paste detection
#sonar.cpd.exclusions=

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.

Update
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.)

Hi, I am facing the same issue. I had the exact same situation where the analysis stop detecting new code and then a few weeks later it was working again without explication. Since a few weeks it stopped again and I have no idea how to understand what is failing