SonarQube dashboard is empty in PR analysis

I use Bitbucket as a source code repository and Jenkins as a CI/CD the programming language are mostly PHP, JavaScript, CSS and YAML
When I go to my open PR in Bitbucket I see the SonarQube there:
bit bucket

I’m trying to run PR analysis from Jenkins but the dashboard in Sonarqube is empty and there is no source as you can see in the image below. When I click the See the PR button it redirects me to bitbucket PR.

Here is what my pipeline looks like:

        stage('SonarQube PR analysis') {
            agent any
            environment {
                SCANNER_HOME = tool 'SonarScaner-4.8'
            }
            tools{
                nodejs 'NodeJS9'
            }
            steps {
                script{
                    withSonarQubeEnv('SonarQube') {
                        sh "${SCANNER_HOME}/bin/sonar-scanner \
                            -Dsonar.projectKey=project-PR-Analysis \
                            -Dsonar.scm.revision=${CommitHash} \
                            -Dsonar.sources=src \
                            -Dsonar.pullrequest.key=${env.CHANGE_ID} \
                            -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} \
                            -Dsonar.pullrequest.base=master"
                    }
                }
            }
        }

Here are the logs of the pipeline :

[2023-07-05T14:49:54.432Z] INFO: HTML-Dependency-Check report does not exist.

[2023-07-05T14:49:54.432Z] INFO: Process Dependency-Check report (done) | time=4ms

[2023-07-05T14:49:54.432Z] INFO: Sensor Dependency-Check [dependencycheck] (done) | time=4ms

[2023-07-05T14:49:54.432Z] INFO: Sensor Zero Coverage Sensor

[2023-07-05T14:49:54.432Z] INFO: Sensor Zero Coverage Sensor (done) | time=26ms

[2023-07-05T14:49:54.432Z] INFO: 7 files had no CPD blocks

[2023-07-05T14:49:54.432Z] INFO: Calculating CPD for 66 files

[2023-07-05T14:49:54.533Z] INFO: CPD calculation finished

[2023-07-05T14:49:54.634Z] INFO: SCM writing changed lines

[2023-07-05T14:49:54.634Z] INFO: SCM writing changed lines (done) | time=7ms

[2023-07-05T14:49:54.634Z] INFO: Analysis report generated in 84ms, dir size=210 KB

[2023-07-05T14:49:54.735Z] INFO: Analysis report compressed in 83ms, zip size=91 KB

[2023-07-05T14:49:54.735Z] INFO: Analysis report uploaded in 34ms

[2023-07-05T14:49:54.735Z] INFO: ANALYSIS SUCCESSFUL, you can browse http://sonar.company.com/dashboard?id=heracles-pimcore-PR-Analysis&pullRequest=845

[2023-07-05T14:49:54.735Z] INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report

[2023-07-05T14:49:54.735Z] INFO: More about the report processing at http://sonar.company.com/api/ce/task?id=AYkmiADer5tR_kXDLLIP

[2023-07-05T14:49:54.936Z] INFO: Analysis total time: 21.807 s

[2023-07-05T14:49:54.936Z] INFO: ------------------------------------------------------------------------

[2023-07-05T14:49:54.936Z] INFO: EXECUTION SUCCESS

[2023-07-05T14:49:54.936Z] INFO: ------------------------------------------------------------------------

[2023-07-05T14:49:54.936Z] INFO: Total time: 25.140s

[2023-07-05T14:49:55.037Z] INFO: Final Memory: 26M/97M

[2023-07-05T14:49:55.037Z] INFO: ------------------------------------------------------------------------

My sonar qube version is 7.9.1 Developer Edition.

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.1 → 8.9.10 → 9.9 → 10.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If your issue persists after upgrade, please come back to us.

Hi Colin,

Thank you for the fast replay.

I will try to update the SonarQube to the latest version or the current LTS and see if I still have my issue.

Thanks again.

Hi Colin,

I know it has been a long time since I asked my question. I updated the SonarQube from 7.9.1 to 9.9.1
I configured my project there and did an analysis on the master branch everything was fine, but the Pull Request still doesn’t show any code.
Any idea what it could be?
Thanks

Thanks.

And there is legitimately new source code (not just changes to a Jenkinsfile) in the pull request?

Thanks Colin, for the fast response this was the problem that I had changes only in the (Jenkinsfile). I made some changes somewhere else and it worked many thanks.

I have another question, I’m getting this warning in the SonarQube: JavaScript/TypeScript/CSS rules were not executed. Only Node.js v14.17 or later is supported, and got 9.0. in Jenkins tools I have updated the version of NodeJS to 19.0.0 but I still get this so the JS and CSS files are not analyzed.
Any idea on this?

Make sure that running node -v before the analysis returns a compatible version (14.17 or later)

Many thanks, Colin

I fixed also that warning.
I will mark your previous answer as the solution to this issue this as a solution.
Really appreciate your help, all the best

1 Like

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