Code Climate CLI
Ruby Shell Other
Latest commit 1d49779 Jan 12, 2017 @ale7714 ale7714 committed on GitHub Revert "Test branch" (#543)
Permalink
Failed to load latest commit information.
benchmarks PathTree extract node types into separate classes Feb 18, 2016
bin Don't update marketing site data on deploy (#484) Aug 23, 2016
config Add CodeScan engine with beta channel Nov 15, 2016
lib/cc Fix typo in lvar name Dec 21, 2016
spec Revert "Test branch" (#543) Jan 11, 2017
.codeclimate.yml Turn on duplication engine Sep 22, 2016
.dockerignore Run specs in docker, wait on killed containers Jan 31, 2016
.gitignore Output test results in JUnit XML for CircleCI May 7, 2016
.rubocop.yml Fix CC issues Apr 15, 2016
.ruby-style.yml Open source commit Jun 19, 2015
.ruby-version Open source commit Jun 19, 2015
DEVELOPERS.md Fix minor inconsistencies in DEVELOPERS.md Dec 18, 2015
Dockerfile Refactor handling of mounted code and tmp paths Mar 11, 2016
Gemfile Revert "Test branch" (#543) Jan 11, 2017
Gemfile.lock Revert "Test branch" (#543) Jan 11, 2017
ISSUE_TEMPLATE.md Add information about using as a gem Aug 17, 2016
LICENSE Open source commit Jun 19, 2015
Makefile Change order of operations in make citest Sep 22, 2016
README.md Fix explicit docker example in README Dec 15, 2016
Rakefile Output test results in JUnit XML for CircleCI May 7, 2016
VERSION Release v0.43.1 Dec 14, 2016
WERE_HIRING.md Enable markdownlint and fix issues Aug 24, 2016
base_rubocop.yml Update to our latest rubocop config Apr 15, 2016
circle.yml Add test coverage token to the circle.yml (#493) Sep 23, 2016
codeclimate-wrapper Pass engine parameter ENV vars through wrapper (#461) Jun 16, 2016
codeclimate.gemspec Update codeclimate-yaml to 0.11.0 Nov 11, 2016

README.md

Code Climate CLI

Code Climate

Overview

codeclimate is a command line interface for the Code Climate analysis platform. It allows you to run Code Climate engines on your local machine inside of Docker containers.

Prerequisites

The Code Climate CLI is distributed and run as a Docker image. The engines that perform the actual analyses are also Docker images. To support this, you must have Docker installed and running locally. We also require that the Docker daemon supports connections on the default Unix socket /var/run/docker.sock.

On OS X, we recommend using Docker Machine.

Installation

docker pull codeclimate/codeclimate

Usage

docker run \
  --interactive --tty --rm \
  --env CODECLIMATE_CODE="$PWD" \
  --volume "$PWD":/code \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp/cc:/tmp/cc \
  codeclimate/codeclimate help

Packages

The above is very transparent. It's clear what's happening, and any changes required to work with your specific Docker setup can be discovered easily. That said, it can be unwieldy to invoke such a command on a regular basis.

For this reason, we also provide packages that include a small wrapper script for the above invocation:

OS X

brew tap codeclimate/formulae
brew install codeclimate

To update the brew package, use brew update first:

brew update
brew upgrade codeclimate

Anywhere

curl -L https://github.com/codeclimate/codeclimate/archive/master.tar.gz | tar xvz
cd codeclimate-* && sudo make install

Commands

A list of available commands is accessible by running codeclimate or codeclimate help.

$ codeclimate help

Available commands:
    analyze [-f format] [-e engine(:channel)] [--dev] [path]
    console
    engines:disable <engine_name>
    engines:enable <engine_name>
    engines:install
    engines:list
    engines:remove
    help
    init
    validate-config
    version

The following is a brief explanation of each available command.

  • analyze Analyze all relevant files in the current working directory. All engines that are enabled in your .codeclimate.yml file will run, one after another. The -f (or format) argument allows you to set the output format of the analysis (using json, text, or html). The --dev flag lets you run engines not known to the CLI, for example if you're an engine author developing your own, unreleased image.

    You can optionally provide a specific path to analyze. If not provided, the CLI will analyze your entire repository, except for your configured exclude_paths. When you do provide an explicit path to analyze, your configured exclude_paths are ignored, and normally excluded files will be analyzed.

  • console start an interactive session providing access to the classes within the CLI. Useful for engine developers and maintainers.
  • engines:disable engine_name Changes the engine's enabled: node to be false in your .codeclimate.yml file. This engine will not be run the next time your project is analyzed.
  • engines:enable engine_name Installs the specified engine (engine_name). Also changes the engine's enabled: node to be true in your .codeclimate.yml file. This engine will be run the next time your project is analyzed.
  • engines:install Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines.
  • engines:list Lists all available engines in the Code Climate Docker Hub .
  • engines:remove engine_name Removes an engine from your .codeclimate.yml file.
  • help Displays a list of commands that can be passed to the Code Climate CLI.
  • init Generates a new .codeclimate.yml file in the current working directory.
  • validate-config Validates the .codeclimate.yml file in the current working directory.
  • version Displays the current version of the Code Climate CLI.

Environment Variables

  • To run codeclimate in debug mode:

    CODECLIMATE_DEBUG=1 codeclimate analyze
    

    Prints additional information about the analysis steps, including any stderr produced by engines.

  • To increase the amount of time each engine container may run (default 15 min):

    # 30 minutes
    CONTAINER_TIMEOUT_SECONDS=1800 codeclimate analyze
    
  • You can also configure the default alotted memory with which each engine runs (default is 512,000,000 bytes):

    # 100,000,0000 bytes
    ENGINE_MEMORY_LIMIT_BYTES=1000000000 codeclimate analyze
    

Copyright

See LICENSE