Test Coverage - Branch Names

Successfully generating test coverage for your branches, but not seeing the results populated in GitHub via the browser extension or PR statuses?

Code Climate Needs:

  • GIT_COMMIT_SHA
  • GIT_BRANCH

How to:

Here's the basic troubleshooting checklist, with additional details below:

  1. Get debug output from your CI build using the --debug option
  2. View the output
  3. Check your CI's env var names
  4. Adjust your coverage setup

Get debug output

The cc-test-reporter command has an option to output additional debug messages during operation.

For single builds, use:

  • after-build --debug.

For tests run in parallel, use:

  • format-coverage --debug and upload-coverage --debug.

View CI output

Once you've added the --debug option, you'll find the branch name identified in your build log, like this:


Check your CI's environmental variable names

When looking at a payload, Code Climate looks for a specific set of environmental variable names.

Double-check to make sure your CI's GIT_COMMIT_SHA and GIT_BRANCH variable names can be matched against the ones listed at the bottom of this file:


Adjust coverage setup as needed

Working with a Docker container?

When using docker, it’s common to not export the git directory to the workspace, which means our test reporter requires environment variables to get the information it needs. Make sure to pass the environment variables through.

You could pass the env variable to the docker container doing something like this:

 docker run \
      --env CI \
      --env CIRCLECI \
      --env CIRCLE_BUILD_NUM \
      --env CIRCLE_BRANCH \
      --env CIRCLE_SHA1 \
    your-org/app bundle exec rspec