Bitbucket Pipelines

Using Code Climate with Bitbucket Pipelines

Bitbucket Pipelines allows users to create flexible, user defined builds for their repositories. Code Climate is happy to offer support for Pipelines, and this document explains how to set up a Pipeline step that will notify Code Climate that new code is ready for analysis.

📘

Bitbucket Pipelines is only supported for repositories added to Code Climate organizations, which requires a paid plan.

  1. Add your Bitbucket repository to Code Climate, following the steps in our Bitbucket integration doc
  2. Enable Pipelines in your Bitbucket repository, following the steps in this document from Atlassian
  3. Copy the analyze-with-code-climate.bash file from this example repository into your own
  4. Add analyze-with-code-climate.bash to your Pipelines build configuration
  5. Add two environment variables to your Pipelines settings:
    i. CODE_CLIMATE_API_KEY - you can find this under Integrations in your Organization's Settings:
1000 934

ii. CODE_CLIMATE_REPO_ID - you can find this in the URL for your repo on Code Climate :

495

Once you've completed these steps, you'll be able to add Code Climate as a step in your Builds with the following example config:

```
pipelines:
  default:
    - step:
        script:
          - pip install -U tox
          - tox
          - ./analyze-with-code-climate.bash
```

And that’s it!