Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Configuration Checklist

  1. Verify your SonarQube™ server settings in global settings of Bitbucket

  2. Run SonarQube™ source code analysis for main branch

    1. Configure the source code analysis

    2. Analysis results must be visible in SonarQube™

  3. Configure corresponding SonarQube™ project in repo settings of Bitbucket

  4. Go to source code view and see the existing issues/stats

    1. You should see the SonarQube™ statistics and issue annotation

      Image ModifiedImage Modified
    2. Statistics and annotations are missing? Verify your Bitbucket repository configuration:

      1. Did you configure the correct analysis directory?

      2. Does the SonarQube™ project key match with the configuration in Bitbucket?

        Image Modified

  5. Create a pull request with issues in the code.

  6. Run SonarQube™ source code analysis for source branch of your pull request.

  7. Go to the pull request view and check if the analysis results are visible. You should see a quality gate status overview, and issue annotations in the pull request diff.

    1. An error

      Image Modified

      hints at a wrong analysis configuration or a wrong analysis directory setting

    2. No issue annotations:

      1. Verify that you can see the issues that should be shown in SonarQube™

      2. Do the issue annotations appear after clicking “Refreshing Sonar™ analysis” in the pull request overview? Then check your Webhook configuration

1. Sonar™ issue information not found

...

b) Verify that you have configured a webhook in SonarQube™ for the Include Code Quality for Bitbucket app and that the last delivery status is OK (green). If it is red like in the following screen shot or if you don’t see a webhook entry for this app, check our Webhook troubleshooting guide:

...

c) For MySQL/MariaDB users: check that you use UTF-8 encoding instead of latin1 or similar, otherwise you will not see annotations in your pull request and DataTruncationException in your Bitbucket server log.
To fix this, change the DB encoding for the Bitbucket database tables to UTF-8 as described in the linked Atlassian ticket.

4. Receiving the error message of “The ‘component’ parameter is missing”.

...

Two places to check the URL:

  1. On Bitbucket in Include Code Quality for Bitbucket server config:

    1. Ensure to properly set the Display URL in your Include Code Quality for Bitbucket Server Configuration, if it’s different then Application URL.

  2. On SonarQube™: make sure to set the Server base URL correctly on your SonarQube™ server:

    1. Log in to the SonarQube™ dashboard and click on the “Administration” tab.

    2. Browse to the “Configuration -> General settings -> General” menu.

    3. Under the “General” section, change the “Server base URL” to the correct server domain name.

    4. Save the changes.

7. Plugin unable to start

...