This article is about General Codeship Configuration.

Using Codacy For Code Coverage

You'll need roughly 2 minutes to read this article.

About Codacy

Codacy is an automated code coverage service. Starting with Codacy and Codeship is fast and easy.

By using Codacy you can help enforce higher standards of code quality and transparency with your engineering tea.

Their documentation does a great job of providing more information, in addition to the setup instructions below.

Codeship Pro

Adding Project Token

To start, you need to add your CODACY_PROJECT_TOKEN to the encrypted environment variables that you encrypt and include in your codeship-services.yml file.

Project Configuration

Once your Codacy project ID is loaded via your environment variables, you will need to install the Codacy package into your Dockerfile via your preferred package manager.

You can find specific instructions per-language over at the Codacy documentation.

The next step will vary by language. Some of the Codacy packages will automatically run whenever your tests run, while some will require separate commands added to your codeship-steps.yml file.

For instance the Rails gem will automatically update your coverage report and export it to Codacy and requires no additional steps, whereas the Python package will require an additional command placed either directly in your codeship-steps.yml file or inside of a script:

- name: codacy
  service: app
  command: python-codacy-coverage -r coverage.xml

Note that the above command is only for Python. We recommend reviewing [their documentation](Their documentation for your specific language to be sure the necessary commands are run.

Codeship Basic

Adding Project Token

To start, you need to add your CODACY_PROJECT_TOKEN to your to your project’s environment variables.

You can do this by navigating to Project Settings and then clicking on the Environment tab.

Project Configuration

Once your Codacy project ID is loaded via your environment variables, you will need to install the Codacy package via your preferred package manager in your project’s setup commands.

You can find specific instructions per-language over at the Codacy documentation.

The next step will vary by language. Some of the Codacy packages will automatically run whenever your tests run, while some will require separate commands added to your project’s test commands.

For instance the Rails gem will automatically update your coverage report and export it to Codacy and requires no additional steps, whereas the Python package will require an additional command placed either directly in your [test commands or inside of a script:

python-codacy-coverage -r coverage.xml

Note that the above command is only for Python. We recommend reviewing [their documentation](Their documentation for your specific language to be sure the necessary commands are run.