Skip to content

Bitbucket integration#

The Bitbucket integration incorporates Codacy on your existing Git provider workflows by reporting issues and the analysis status directly on your pull requests.

When you add a new repository, Codacy sets the Bitbucket integration using the default settings for your organization. You can then customize the settings for the repository.

Bitbucket integration

Important

Codacy uses the Bitbucket user who added the repository to create comments on pull requests. If that user loses access to the repository, a repository admin must refresh the Bitbucket integration.

Configuring the Bitbucket integration#

To configure the Bitbucket integration, open your repository Settings, tab Integrations.

Depending on the options that you enable, Codacy will automatically update pull requests on Bitbucket with extra information when accepting pull requests.

Tip

You can apply the default Git provider integration settings to all repositories to ensure that your repositories all share the same settings.

Status checks#

Adds a report to your pull requests showing whether your pull requests and coverage are up to standards or not as configured on the quality gate rules for your repository. You can then optionally block merging pull requests that aren't up to standards.

Important

To get a status for coverage you must also:

Pull request status on Bitbucket

Issue annotations#

Adds comments on the lines of the pull request where Codacy finds new issues. Click on the links to open Codacy and see more details about the issues and how to fix them. To enable this option, you must enable Status checks first.

Pull request comment on Bitbucket

Issue summaries#

This feature isn't available for Bitbucket Server

Shows an overall view of the changes in the pull request, including new issues and metrics such as complexity and duplication. To enable this option, you must enable Status checks first.

Pull request summary on Bitbucket

AI-Enhanced Comments#

Adds AI-enhanced comments with insights to help you fix identified issues.

Note

  • This feature is compatible with most programming languages and requires no additional setup.
  • Comments are generated using the description of the static analysis issue, information about the tool that detected the issue, and a few lines of surrounding code to provide the AI with extra context and improve its accuracy.
  • This feature leverages the OpenAI API. No information is shared with other third parties or used to train AI models. Please refer to the OpenAI API data usage policies for more information.

AI-enhanced comment on GitLab

Refreshing the Bitbucket integration#

If the user who added the repository to Codacy loses access to the repository, which may happen when the user leaves the team or the organization, Codacy won't be able to create comments on pull requests.

In this situation, another user with administrator access to the repository needs to refresh the Bitbucket integration:

Tip

Use a dedicated service account to integrate Codacy with your repositories. This prevents disruption of service if the user who originally enabled the integration loses access to the repositories, which may happen when a user leaves the team or the organization.

For more information and instructions on how to set up a dedicated service account see Why did Codacy stop commenting on pull requests?

  1. Open the repository Settings, tab Integrations.

  2. On the Bitbucket integration area, click the link Refresh connection.

    Refresh Bitbucket integration

After refreshing the integration, Codacy will use the logged in Bitbucket user to create comments on new pull requests.

Generating automatic pull request summaries#

This is a preview feature

This is an upcoming Codacy feature. If you're interested, contact support@codacy.com for early access.

Codacy can provide a clear, high-level summary of the code changes introduced by a pull request, based on the committed code. Codacy generates an overview of the changes in the pull request so that any reviewer can understand its intent and impact.

Automatic Summary on Bitbucket

Note

  • This feature uses only AWS services within Codacy's existing infrastructure. No information is shared with any other third party or used to train AI models.
  • Summaries are generated using the pull request title, branch name, commit messages, and changes diff.

To enable this feature, add the following to the Codacy configuration file .codacy.yaml in the root of your repository:

---
reviews:
  high_level_summary: true

You can also enable this feature across your organization by creating the above file in the root of a repository named .codacy. This file will be used as the default configuration for all repositories in the organization and overridden by repository-specific configuration files.

Once enabled, summaries will be created when pull requests are opened and updated at each commit to reflect any changes to the pull request.

Pull requests opened by bots, such as Dependabot, are ignored.

If you see duplicated comments posted by Codacy on the same pull request, please ensure that your repository only has one configured webhook for Codacy.

See also#

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

Edit this page on GitHub if you notice something wrong or missing.

If you have a question or need help please contact support@codacy.com.

Last modified July 4, 2024