Python Project - The main branch of this project is empty

I am running community edition of sonarqube (version 8.8) on GKE.
I have created a public project using the Administrator user and running a jenkins job for python code analysis.

Below is my sonarqube-scanner properties in Jenkins job:

sonar.projectKey=ws-main
sonar.scm.disabled = True
sonar.sources=./$branch/${BUILD_NUMBER}/backend/
sonar.language=py
sonar.host.url=http://<ip-address-of-sonarqube>
sonar.login=<project-key>

I also created few users manually from the Sonarqube UI which by default belongs to sonar-users group and provided them the below access:

Upon successful analysis of the code, as an administrator user, I am able to see the dashboard with all the issues like bugs, vulnerabilities , security hotspots etc. But when I am seeing the same dashboard as any users belonging to the group sonar-users, I am unable to see anything in the dashboard. And I am getting below error:

Also, I have provided the access to all the users of the group sonar-users for the project. Can anyone help me how I can make these projects accessible to all the users?

Hi,

Welcome to the community!

In fact, this question gets asked a lot. Have you looked at any of the other threads with the phrase “The main branch of this project is empty”?

 
Ann

Yes, I looked into the other threads and tried whatever was suggested but it did not work.

Hi,

Those threads asked a lot of things. Let’s tick through some of them:

What edition are you on? Do you have? Is there a dropdown next to the word “master”? Is it possible that all of your files are being interpreted as test files? If not, perhaps you could share your analysis logs?

 
Ann

Thanks for replying.

We are running the below version:

Community Edition
Version 8.8 (build 42792).

Here are the logs:

[INFO] ------------- Run sensors on module ws-main
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=27ms
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 11
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=13ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=4ms
[INFO] Java Main Files AST scan
[INFO] 351 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=62ms
[INFO] 53/351 files analyzed, current file: src/main/java/com/companyName/infrastructure/common/GcsExportFileWriter.java
[INFO] 134/351 files analyzed, current file: src/main/java/com/companyName/ui/task/dto/TaskDto.java
[INFO] 245/351 files analyzed, current file: src/main/java/com/companyName/domain/common/model/SortType.java
[INFO] 327/351 files analyzed, current file: src/main/java/com/companyName/infrastructure/common/DSyncRepository.java
[INFO] 351/351 source files have been analyzed
[INFO] Slowest analyzed files:
    src/main/java/com/companyName/infrastructure/report/ChartQueryBuilder.java (2074ms)
    src/main/java/com/companyName/infrastructure/common/DataFormatter.java (1468ms)
    src/main/java/com/companyName/infrastructure/common/xlsx/StreamingReader.java (1452ms)
    src/main/java/com/companyName/infrastructure/report/ReportQueryBuilder.java (1391ms)
    src/main/java/com/companyName/ui/common/dto/SearchRequest.java (1155ms)
[WARNING] Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
[INFO] Java Main Files AST scan (done) | time=41903ms
[INFO] Java Test Files AST scan
[INFO] 40 source files to be analyzed
[INFO] 40/40 source files have been analyzed
[WARNING] Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
[INFO] Java Test Files AST scan (done) | time=5540ms
[INFO] Java Generated Files AST scan
[INFO] 0 source files to be analyzed
[INFO] 0/0 source files have been analyzed
[INFO] Java Generated Files AST scan (done) | time=1ms
[INFO] Sensor JavaSquidSensor [java] (done) | time=47832ms
[INFO] Sensor CSS Rules [cssfamily]
[INFO] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[INFO] Sensor CSS Rules [cssfamily] (done) | time=3ms
[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=283ms
[INFO] Sensor C# Project Type Information [csharp]
[INFO] Sensor C# Project Type Information [csharp] (done) | time=2ms
[INFO] Sensor C# Properties [csharp]
[INFO] Sensor C# Properties [csharp] (done) | time=1ms
[INFO] Sensor SurefireSensor [java]
[INFO] parsing [/home/jenkins/workspace/DevOps/Daily_Sonarqube_Code_Analysis_Java/master/43/java/main/target/surefire-reports]
[INFO] Sensor SurefireSensor [java] (done) | time=123ms
[INFO] Sensor JavaXmlSensor [java]
[INFO] 1 source file to be analyzed
[INFO] 1/1 source file has been analyzed
[INFO] Sensor JavaXmlSensor [java] (done) | time=246ms
[INFO] Sensor HTML [web]
[INFO] Sensor HTML [web] (done) | time=7ms
[INFO] Sensor XML Sensor [xml]
[INFO] 1 source file to be analyzed
[INFO] 1/1 source file has been analyzed
[INFO] Sensor XML Sensor [xml] (done) | time=203ms
[INFO] Sensor VB.NET Project Type Information [vbnet]
[INFO] Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
[INFO] Sensor VB.NET Properties [vbnet]
[INFO] Sensor VB.NET Properties [vbnet] (done) | time=2ms
[INFO] ------------- Run sensors on project
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=2ms
[INFO] Sensor Java CPD Block Indexer
[INFO] Sensor Java CPD Block Indexer (done) | time=309ms
[INFO] CPD Executor 149 files had no CPD blocks
[INFO] CPD Executor Calculating CPD for 202 files
[INFO] CPD Executor CPD calculation finished (done) | time=74ms
[INFO] Analysis report generated in 146ms, dir size=2 MB
[INFO] Analysis report compressed in 813ms, zip size=1 MB
[INFO] Analysis report uploaded in 141ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://<url_of_sonarqube>/dashboard?id=ws-main
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://<url_of_sonarqube>/api/ce/task?id=AXlUFP0WZorsgRPR3T5Y
[INFO] Analysis total time: 53.842 s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Hi,

Your initial analysis properties list included sonar.language=py but your analysis log shows only Java files being analyzed, not Python. Is this the right analysis log? Is it the entire analysis log? Also, if you go to the Measures tab, what do you see?

 
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.