Maximious
Maximious

Reputation: 165

Sonarqube error : The main branch of this project is empty

Today I installed sonarqube and sonarqube runner to scan my php project . But after running the scanner it shows The main branch of this project is empty. .

sonar-scanner.properties

#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here

#----- Default SonarQube server
#sonar.host.url=http://localhost:9000

#----- Default source code encoding
#sonar.sourceEncoding=UTF-8


sonar.projectKey=raka
# --- optional properties ---

# defaults to project key
#sonar.projectName=My project
# defaults to 'not provided'
#sonar.projectVersion=1.0
 
# Path is relative to the sonar-project.properties file. Defaults to .
#sonar.sources=.
 
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

Can anyone tell me what i did wrong? Please help I am new in PHP

Upvotes: 0

Views: 12549

Answers (3)

thank_for_this
thank_for_this

Reputation: 55

I experienced the same issue. It can be resolved by either running the analysis inside the project folder or editing the 'sonar.sources' property with the appropriate path.

Upvotes: 0

Parvez Kazi
Parvez Kazi

Reputation: 795

In my case, I had changed file suffixes for the language my code was.

sonar.ruby.file.suffixes = .rbt

It was .rb before, had changed it for some testing and forgot to revert.

Upvotes: 1

Sourav
Sourav

Reputation: 3402

This error occurred because there are no source files that has been analysed by sonarqube because in the sonar-scanner.properties, you have commented out the analysis property sonar.sources=.

Sonarqube needs source files to be scanned so as to show the Sonar scan results. If there are no source files to be analysed then it will throw this error: The main branch of this project is empty.

Changes in sonar-scanner.properties file

#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here

 #----- Default SonarQube server
 #sonar.host.url=http://localhost:9000

 #----- Default source code encoding
 sonar.sourceEncoding=UTF-8


 sonar.projectKey=raka
 # --- optional properties ---

 # defaults to project key
 #sonar.projectName=My project
 # defaults to 'not provided'
 sonar.projectVersion=1.0

 # Path is relative to the sonar-project.properties file. Defaults to .
  sonar.sources=.

Upvotes: 3

Related Questions