GithubHelp home page GithubHelp logo

stefb965 / codeclimate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeclimate/codeclimate

0.0 2.0 0.0 1.31 MB

Code Climate CLI

Home Page: https://codeclimate.com/

License: GNU Affero General Public License v3.0

Ruby 90.58% Makefile 0.58% Shell 2.38% HTML 6.46%

codeclimate's Introduction

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 macOS, we recommend using Docker for Mac.

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

To upgrade to a newer version, just run those steps again.

Updating existing Code Climate configuration

If you are already using Code Climate and have a .codeclimate.yml file within your repository, you will probably want to run:

codeclimate init --upgrade

This will generate .yml files that will enable CodeClimate CLI to run with the configuration that is automatically generated by Code Climate, ensuring that the output matches between the two.

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.

    You can also pipe in source in combination with a path to analyze code that is not yet written to disk. This is useful when you want to check if your source code style matches the project's. This is also a good way to implement integration with an editor to check style on the fly.

  • 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

codeclimate's People

Contributors

pbrisbin avatar gdiggs avatar wfleming avatar dblandin avatar fhwang avatar jpignata avatar brynary avatar mrb avatar maxjacobson avatar noahd1 avatar pointlessone avatar blakewilliams avatar afestein avatar toddmohney avatar nporteschaikin avatar ivantsepp avatar dbergey avatar ablyler avatar sysadmiral avatar squaresurf avatar diegoamc avatar eliotsykes avatar lucasmazza avatar mmornati avatar mikz avatar zenspider avatar sgerrand avatar elcuervo avatar faza avatar mckinnsb avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.