Configuring The Prepare Step

Sharing configuration between multiple projects

Developers who work with multiple repositories may want to use external configurations for engines to ensure consistent engine results between those repositories. Code Climate makes it easy to keep these shared configuration files in a single location and have them fetched on-demand when analysis is performed. To configure your analysis to fetch remote files, add a prepare key to your .codeclimate.yml:

prepare:
  fetch:
  - url: "https://raw.githubusercontent.com/thoughtbot/guides/master/style/ruby/.rubocop.yml"
    path: ".rubocop.yml"

Each fetch value can either be a URL string or a hash specifying URL and path. The latter is useful when you want to rename the downloaded file or place it within a non-root directory.

For example, these two examples result in equivalent behavior:

prepare:
  fetch:
    - "https://raw.githubusercontent.com/example/example/master/.rubocop.yml"
prepare:
  fetch:
    - url: "https://raw.githubusercontent.com/example/example/master/.rubocop.yml"
      path: ".rubocop.yml"

We recommend adding files you fetch using prepare to your repository's .gitignore: this will help ensure you don't accidentally commit the files, and users will remember to fetch the most recent versions.

📘

Private repos

Currently, we're not able to fetch if the configuration lives in a private repo. Feel free to use a public style guide repo and link to that. Or, upload it as a gist and point to the raw URL.

You can also fetch these files locally using the Code Climate CLI:

$ codeclimate prepare