Giter Site home page Giter Site logo

codeclimate / codeclimate Goto Github PK

View Code? Open in Web Editor NEW
2.5K 2.5K 248.0 1.62 MB

Code Climate CLI

Home Page: https://codeclimate.com/

License: GNU Affero General Public License v3.0

Ruby 90.23% Makefile 0.68% Shell 2.98% HTML 5.82% Dockerfile 0.30%
climate-cli code-quality codeclimate codeclimate-engine docker quality static-analysis static-code-analysis

codeclimate's Introduction

Code Climate CLI

Code Climate CircleCI

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

macOS

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.

Manual Docker invocation

The above packages pull the docker image and install a shell script wrapper. In some cases you may want to run the docker image directly.

To pull the docker image:

docker pull codeclimate/codeclimate

To invoke the CLI via Docker:

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

Project setup

Configuration

No explicit configuration is needed: by default codeclimate analyze will evaluate supported source files in your repository using our maintainability checks. To change default configuration to customize how the maintainability checks are evaluated, or to turn on open source plugins, see our documentation on advanced configuration.

Plugin installation

Plugins, or "engines", are the docker images that run analysis tools. We support many different plugins, and will only install the ones necessary to run analysis. As part of setting up your project, we recommend running codeclimate engines:install from within your repository before running codeclimate analyze, and after adding any new plugins to your configuration file.

Running analysis

Once you've installed plugins and made any necessary changes to your configuration, run codeclimate analyze to run analysis and see a report on any issues in your repository.

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:install
    engines:list
    help [command]
    prepare [--allow-internal-ips]
    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:install Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines and checks for new images available for existing engines.

  • engines:list Lists all available engines in the Code Climate Docker Hub .

  • help Displays a list of commands that can be passed to the Code Climate CLI.

  • 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 1,024,000,000 bytes):

    # 2,000,000,000 bytes
    ENGINE_MEMORY_LIMIT_BYTES=2000000000 codeclimate analyze
    

Releasing a new version

CLI's new versions are released automatically when updating VERSION on master.

The releasing process includes;

  1. Push new version to rubygems.
  2. Create a new release on Github and an associated tag.
  3. Update docker images:
  • Push new latest image.
  • Push new image with latest version as tag.

Ideally someone will open a pull request against master updating only VERSION.

There is script in place, which assumes hub is installed, to facilitate that. Check the current VERSION (cat VERSION) and upgrade accordingly running:

./bin/prep-release <VERSION>

Copyright

See LICENSE

codeclimate's People

Contributors

afestein avatar andrewraycode avatar blakewilliams avatar brianhawley avatar brynary avatar camillof avatar dantevvp avatar dblandin avatar eutopian avatar fede-moya avatar fhwang avatar filipesperandio avatar gdiggs avatar jpignata avatar larkinscott avatar matteeyah avatar maxjacobson avatar mrb avatar noahd1 avatar noelia-lencina avatar nporteschaikin avatar pbrisbin avatar pointlessone avatar rubybrewsday avatar tillig avatar toddmazierski avatar toddmohney avatar wfleming avatar wilson avatar zenspider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codeclimate's Issues

Undefined method `source_buffer_for' for "/code":String

jordan$ codeclimate analyze -f text
Starting analysis
Running eslint: Done!

== Brocfile.js (7 issues) ==
error: (NoMethodError) undefined method `source_buffer_for' for "/code":String
This is especially confusing because there is no method (or even text string) source_buffer_for anywhere in my project, which leads me to believe this error is coming from codeclimate.

/cc @elwayman02

Cannot run `codeclimate analyze`

Trying yields:

error: (CC::Analyzer::UnreadableFileError) Can't read app/models/benchmarking/benchmarking.rb

That's the only thing I get. Is there a way to see the backtrace or a more verbose error message? (The file is readable and writable for my user.)

Permission denied error when trying to enable an engine

I've just installed this in a Linux machine. I'm trying to add a new engine by doing:

$ codeclimate engines:enable rubocop

But I'm getting the following error:

error: (Errno::EACCES) Permission denied @ rb_sysopen - /code/.codeclimate.yml

Install process errors during bin/check phase

Following the Linux install instructions, but sudo make install is failing during the bin/check step.

Note: I am running this from within a Docker container.

$ docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64

$ curl -L https://github.com/codeclimate/codeclimate/archive/master.tar.gz | tar xvz
<<snipped>>

$ cd codeclimate-* && sudo make install
bin/check
time="2015-09-19T16:21:17Z" level=fatal msg="Get http:///var/run/docker.sock/v1.18/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?" 
Unable to run `docker version', the docker daemon may not be running
Please ensure `docker version' succeeds and try again
make: *** [install] Error 1

$ docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64

$ env | grep -i docker
DOCKER_HOST=tcp://192.168.59.103:2376
DOCKER_TLS_VERIFY=1

☺ ~/codeclimate-master 
 [devbox 16:22:34] $ ./bin/check 

☺ ~/codeclimate-master 
 [devbox 16:22:35] $ echo $?
0

What you can see here is:

  • docker version is happy. I am able to use the Docker client from within this shell. Therefore, I think the codeclimate CLI install should succeed
  • Docker is configured to use a remote DOCKER_HOST and DOCKER_TLS_VERIFY is set to true.
  • Curiously, running bin/check from within the ./codeclimate-master directory exits cleanly with exit code 0.
  • However, sudo make install appears to error out when it runs bin/check

/c @pbrisbin

Runtime option to analyze single file

Background: The CLI is awesome and I'm sure people are applying it in all sorts of scenarios. The way I see myself using it most often is while trying to resolve issues in a hot spot.

Scenerio: Say I receive a notification that a file I just committed fell from an A to a C rating. It'd be useful if I could use the CLI locally on my machine to re-analyze that file while I'm working on it to see that I'm resolving the issues.

Problem: To my knowledge this isn't currently possible because the CLI doesn't offer the ability to analyze a single file.

Potential solution: Add a runtime option to the analyze command which allows the user to specify the relative path of the file they'd like to analyze.

Thoughts/ideas on how to implement this?

codeclimate init says configuration generated, but no file exists in current directory

I just tried to setup codeclimate, and it seems like it is looking for the configuration file somewhere outside of my current working directory. I'm using OS X w/ boot2docker. Even after attempting to generate the file manually, I get an error saying that the configuration file is missing.

$ codeclimate init
Unable to find image 'codeclimate/codeclimate:latest' locally
latest: Pulling from codeclimate/codeclimate
5b9d2dfd9d1a: Pull complete
b4dadb259a1c: Pull complete
6ea41de46ccf: Pull complete
baf1f7e2ba29: Pull complete
4e909c5c2331: Pull complete
1ebb24d1fdec: Pull complete
1c588d1eb9e6: Pull complete
98c55abc0398: Pull complete
a967ced3541c: Pull complete
da5901963609: Pull complete
99d5739d7667: Pull complete
8f4969843846: Pull complete
77ed7b9128b8: Pull complete
7720e30e7ed3: Pull complete
a61d70f366e5: Already exists
Digest: sha256:95b4ee8959f8ab78d504e2823ed485b15cc510a8b6b29c55606c47375b74c358
Status: Downloaded newer image for codeclimate/codeclimate:latest
Config file .codeclimate.yml successfully generated.
Edit and then try running 'validate-config' to check configuration.
$ ls -al
total 112
drwxr-xr-x  27 ablyler  staff   918 Jul 22 20:14 .
drwxr-xr-x  17 ablyler  staff   578 Jun 22 21:09 ..
-rw-r--r--@  1 ablyler  staff  6148 Apr  6 19:37 .DS_Store
drwxr-xr-x  18 ablyler  staff   612 Jul 22 20:39 .git
-rw-r--r--   1 ablyler  staff   160 Feb  9 10:59 .gitignore
-rw-r--r--   1 ablyler  staff   564 Jun 11 16:46 .gitmodules
drwxr-xr-x   8 ablyler  staff   272 Jul 11 22:01 .idea
-rw-r--r--   1 ablyler  staff    84 Sep 16  2014 README.md

Trouble installing codeclimate CLI on Mac OSX

I've tried to install codeclimate CLI using instruction from readme. Here's the output of the commands during installation. I first tried to install via homebrew. I run brew tap codeclimate/formulae and after that brew install codeclimate.

❯ brew install codeclimate
==> Installing codeclimate from codeclimate/homebrew-formulae
==> Downloading https://github.com/codeclimate/codeclimate/archive/v0.0.7.tar.gz
==> Downloading from https://codeload.github.com/codeclimate/codeclimate/tar.gz/v0.0.7
######################################################################## 100.0%
Error: SHA1 mismatch
Expected: ce5efec690264565e1342b50329a03e8aa39e276
Actual: 9e2b70d12d89ba85cc0174fed5aa473b500a5f12
Archive: /Library/Caches/Homebrew/codeclimate-0.0.7.tar.gz
To retry an incomplete download, remove the file above.

I also had problems getting codeclimate docker image. I'm guessing the IP points to local IP?

❯ docker pull codeclimate/codeclimate
An error occurred trying to connect: Post https://192.168.59.103:2376/v1.19/images/create?fromImage=codeclimate%2Fcodeclimate%3Alatest: dial tcp 192.168.59.103:2376: i/o timeout

If you need any additional info for debugging this, let me know.

EngineFailure error on fresh install

Hey, I just created a new codeclimate.yml using codeclimate init, validated the config and tried to run codeclimate analyze. I got the following error

error: (CC::Analyzer::Engine::EngineFailure) engine rubocop failed with status 1 and stderr "/usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:121:in initialize': Permission denied @ rb_sysopen - /code/dd (Errno::EACCES)\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:121:in open'\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:121:in ruby_executable?'\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:78:in to_inspect?'\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:65:in block in target_files_in_dir'\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:64:in select'\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:64:in target_files_in_dir'\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/target_finder.rb:31:in find'\n\tfrom /usr/lib/ruby/gems/2.2.0/gems/rubocop-0.31.0/lib/rubocop/runner.rb:41:in find_target_files'\n\tfrom /usr/src/app/lib/cc/engine/rubocop.rb:18:in block in run'\n\tfrom /usr/src/app/lib/cc/engine/rubocop.rb:16:in chdir'\n\tfrom /usr/src/app/lib/cc/engine/rubocop.rb:16:in run'\n\tfrom /usr/src/app/bin/codeclimate-rubocop:6:in

'\n"`

The contents of my yml are:

engines:
  rubocop:
    enabled: true
ratings:
  paths:
  - "**.rb"
exclude_paths:
- config/**/*
- db/**/*
- test/**/*
- vendor/**/*

Any thoughts?

codeclimate validate-config: unexpected key "languages", dropping

According to how to set up .codeclimate.yml we should add a key languages to the yml file, source: http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml

However, running validate-config against this gives an error:

> codeclimate validate-config
WARNING: unexpected key "languages", dropping
> codeclimate version
0.0.6

That doesn't make sense...

My .codeclimate.yml is a mix of what codeclimate init gives and what the instructions on the given web page says:


---
#
# ---Choose Your Languages---
# To disable analysis for a certain language, set the language to `false`.
# For help setting your languages:
# http://docs.codeclimate.com/article/169-configuring-analysis-languages
#
languages:
   Ruby: true
   JavaScript: false
   Python: false
   PHP: false
engines:
  rubocop:
    enabled: true
  coffeelint:
    enabled: true
  eslint:
    enabled: true
  csslint:
    enabled: true
ratings:
  paths:
  - "**.rb"
  - "**.coffee"
  - "**.js"
  - "**.jsx"
  - "**.css"
exclude_paths:
- config/**/*
- db/**/*
- spec/**/*
- vendor/**/*

CC::Analyzer::UnreadableFileError on a path that should be excluded

engines:
  rubocop:
    enabled: true
  bundler-audit:
    enabled: true
ratings:
  paths:
  - "lib/**/*"
  - Gemfile
exclude_paths:
 - "test/**/*"
 - ".pry_history"

Running codeclimate analyze produces the following:

fatal: bad config file line 31 in .git/config
error: (CC::Analyzer::UnreadableFileError) Can't read ./.pry_history

(I'm also not sure what's up with the "fatal" error regarding '.git/config' as all seems normal there)

.codeclimate.yml not found when trying to run validate-config

I created a codeclimate.yml file in my project's root directory and attempted to analyze it with the validate-config command locally.

From my project's root directory I ran the following commands after the file was already present:

$ docker run codeclimate/codeclimate validate-config
No '.codeclimate.yml' file found. Run 'codeclimate init' to generate a config file.

$ ls -la .codeclimate.yml
-rw-r--r-- 1 scottspeidel staff 838 Aug 25 14:15 .codeclimate.yml

Is there a way to ask code climate what directory it's looking in?
Or a way to pass the path in on the command line?

Am I missing something here?

Pylint engine?

I would like you guys to add pylint to the analysis, pylint has very useful things like imports not used and arguments not used, etc.

brew install codeclimate no longer works

I've tried untapping and retapping, and uninstalling etc...

I'm assuming this is just a publishing issue since that version was published fairly recently.

➜  ~  brew install codeclimate
==> Installing codeclimate from codeclimate/homebrew-formulae
==> Downloading https://github.com/codeclimate/codeclimate/archive/v0.2.12.tar.gz
Already downloaded: /Library/Caches/Homebrew/codeclimate-0.2.12.tar.gz
Error: SHA1 mismatch
Expected: d205cbd6783332a212c5ae92d73c77178c2d2f28
Actual: c52cbdf349841eddc3ce6697885a25a58f285ad5
Archive: /Library/Caches/Homebrew/codeclimate-0.2.12.tar.gz
To retry an incomplete download, remove the file above.

Should the "console" command be exposed?

If I run codelimate help my options list looks like so in version 0.2.8:

Available commands:
    analyze [-f format]
    console
    engines:disable engine_name
    engines:enable engine_name
    engines:install
    engines:list
    engines:remove engine_name
    help
    init
    validate-config
    version

If I run codeclimate console I get an interactive shell but it doesn't accept any of the normal codeclimate commands and I get this error:

NoMethodError: undefined method `engines' for #<CC::CLI::Console:0x007fd31dd2a800 @args=[]>
from (pry):1:in `run'

I've looked at the code in lib/cc/cli/console.rb (but since I'm not a ruby dev I'm not sure what I'm looking at) and it looks rather sparse.

So my question is should this command be available yet? Is it an impending feature that has made it to the wild? Or something else?

CodeClimate CLI Output

Is there a way to output Codeclimate CLI's console output into a file, like something that brakeman gem does for Rails

Brakeman has a command brakeman -o output.html - was wondering if Codeclimate CLI had something similar coming?

allow local builds of the docker container

it would be nice to be able to build the docker image in order to test local code modifications before submitting a pull request.

/tmp/codeclimate (master ✔) ᐅ docker build .
Sending build context to Docker daemon 137.2 kB
Sending build context to Docker daemon 
Step 0 : FROM codeclimate/alpine-ruby:b36
Pulling repository codeclimate/alpine-ruby
INFO[0003] Repository not found                      

Issue running locally

I suspect this is an issue on my end, but i figure I would post here, maybe someone else has an idea.

docker pull codeclimate/codeclimate:latest
FATA[0000] Post http:///var/run/docker.sock/v1.18/images/create?fromImage=codeclimate%2Fcodeclimate%3Alatest: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
make: *** [install] Error 1

`codeclimate init` error

when i run codeclimate init while I'm in the directory of a project, i get the following error:

error: (Errno::ENOENT) No such file or directory @ dir_chdir - /code

Anyone know what could cause this?

Throwing error during install

hey I am trying to install the codeclimate via brew.

Error while pulling image: Get https://index.docker.io/v1/repositories/codeclimate/codeclimate/images: dial tcp: lookup index.docker.io: no such host
thats the error Im getting.

Im using a fresh install of docker ( docker-machine)

Thoughts?

How to test engines under development?

The engine I'm working on can be run against itself with the analyse --dev command.

I'd now like to run it against some other codebases. I've tried calling the CLI as follows:

docker run \
  --interactive --tty --rm \
  --env CODE_PATH=“/Users/andy/other_code \
  --volume "/Users/andy/other_code":/code \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp/cc:/tmp/cc \
  codeclimate/codeclimate analyze —dev

But the CodeClimate process just hangs when I try this.

Am I going about this the right way?

Version mismatch error

I get the message below when running engines:install in a directory using a YAML file generated by init (which is also given below).

$ sudo docker pull codeclimate/codeclimate
$ sudo docker run \   
  --interactive --tty --rm \
  --env CODE_PATH="$PWD" \
  --volume "$PWD":/code \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp/cc:/tmp/cc \
  codeclimate/codeclimate engines:install
Pulling docker images.
FATA[0000] Error response from daemon: client and server don't have same version (client : 1.18, server: 1.17) 
error: (CC::CLI::Engines::Install::ImagePullFailure) unable to pull image codeclimate/codeclimate-rubocop
---
engines:
  rubocop:
    enabled: true
  eslint:
    enabled: true
  csslint:
    enabled: true
ratings:
  paths:
  - "**.rb"
  - "**.js"
  - "**.jsx"
  - "**.css"

Show progress during Makefile install process

I installed the CLI via brew and it took 3.5 minutes. I looked at the process list and likely most of that time was taken up by updating local docker images. This seems fine, but more progress output would have been helpful, as it looked like the install had hung.

[2.2.2][21:16][~]$ brew install codeclimate
==> Installing codeclimate from codeclimate/homebrew-formulae
==> Downloading https://github.com/codeclimate/codeclimate/archive/v0.8.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/codeclimate-0.8.1.tar.gz
==> env PATH=/usr/local/bin:/usr/local/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/sbin PREFIX=/usr/local/Cellar/codeclimate/0.8.1 ma
🍺  /usr/local/Cellar/codeclimate/0.8.1: 4 files, 16K, built in 3.6 minutes

Unable to pull image

Hi,

I'm working on OSX, installed boot2docker and codeclimate.
Unfortunately I can't install engines:

$ codeclimate engines:install
Pulling docker images.
Pulling repository codeclimate/codeclimate-eslint
FATA[0020] Get https://index.docker.io/v1/repositories/codeclimate/codeclimate-eslint/images: dial tcp: lookup index.docker.io on 10.128.128.128:53: read udp 10.128.128.128:53: i/o timeout 
error: (CC::CLI::Engines::Install::ImagePullFailure) unable to pull image codeclimate/codeclimate-eslint
$ docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): darwin/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64
$ boot2docker status
running

Please let me know if you need more information. I hope I overlooked something obvious...

Several errors against large repo

Fresh install of docker, boot2docker and codeclimate CLI on a MacBook with Yosemite. Project consists of PHP, JS, JSX, CSS, Less and the engines were identified as eslint, csslint and phpcodesniffer. Initial run resulted in:

$ codeclimate analyze
Starting analysis
Running eslint: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine eslint failed with status 137 and stderr ""

Since the PHP code was most interesting I removed the es and css engines from the config and run again with the result of:

$ codeclimate analyze
Starting analysis
Running phpcodesniffer: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine phpcodesniffer failed with status 255 and stderr "PHP Fatal error:  Uncaught exception 'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' with message 'The process \"./vendor/bin/phpcs --report=json --ignore=[test/**/*] --standard=PSR1,PSR2 /code\" exceeded the timeout of 60 sec in /usr/src/app/vendor/symfony/process/Process.php on line 1226\n"

The list of ignored files have been replaced with the glob from the config.

The repo is rather large; 17475 PHP files, 1890 JavaScript files and 424 CSS files. It's a total of some 4.5 million lines of code (according to git stat)...

Engine attempting to access excluded files

I'm on codeclimate 0.2.8 running the following config:


---
engines:
  eslint:
    enabled: true
  csslint:
    enabled: false
  fixme:
    enabled: true
  watson:
    enabled: true
ratings:
  paths:
  - "app/**"
exclude_paths:
- bower_components/**/*
- dist/**/*
- node_modules/**/*
- tests/**/*
- tmp/**/*
- vendor/**/*

I get the following error for codeclimate analyze:

Starting analysis
Running eslint: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine eslint failed with status 1 and stderr
/usr/src/app/node_modules/glob/sync.js:321
        throw er
              ^
Error: EACCES, permission denied '/code/tmp/asset_rewrite-cache_path-RFcmONBd.tmp'
    at Error (native)
    at Object.fs.readdirSync (fs.js:761:18)
    at GlobSync._readdir (/usr/src/app/node_modules/glob/sync.js:275:41)
    at GlobSync._readdirInGlobStar (/usr/src/app/node_modules/glob/sync.js:254:20)
    at GlobSync._readdir (/usr/src/app/node_modules/glob/sync.js:263:17)
    at GlobSync._processGlobStar (/usr/src/app/node_modules/glob/sync.js:330:22)
    at GlobSync._process (/usr/src/app/node_modules/glob/sync.js:128:10)
    at GlobSync._processGlobStar (/usr/src/app/node_modules/glob/sync.js:363:10)
    at GlobSync._process (/usr/src/app/node_modules/glob/sync.js:128:10)
    at GlobSync._processGlobStar (/usr/src/app/node_modules/glob/sync.js:363:10)

The project is an Ember 1.12 app w/ over 32,000 lines of code across 200+ files.

I thought the issue was related to codeclimate/codeclimate-eslint#1, but even disabling eslint surfaces the same error for the fixme engine instead. Seems to be something with the CLI itself, then.

Cannot find module `babel-eslint`

Updated to codeclimate v0.2.5 and each time I run codeclimate analyze the output shows that it can't find the babel-eslint module. I've installed eslint and babel-eslint globally (npm install -g eslint babel-eslint), stopped and restarted boot2docker with no change in the output.

== app/app.js (1 issue) ==
0:0-0:0: Cannot find module 'babel-eslint' [eslint]

== app/components/button/button.js (1 issue) ==
0:0-0:0: Cannot find module 'babel-eslint' [eslint]

.codeclimate.yml

---
engines:
  eslint:
    enabled: true
ratings:
  paths:
  - "**.js"

.eslintrc

{
  "parser": "babel-eslint",
  "env": {
    "browser": true,
    "node": true
  },
  "ecmaFeatures": {
    // ... snip
  },
  "rules": {
    // ... snip
  }

Removing "parser": "babel-eslint" from .eslintrc will output eslint warnings/errors. Is parser not a requirement in the eslint config for the codeclimate CLI?

Issue at installation of docker container

I'm having trouble installing the docker container.

After running docker pull codeclimate/codeclimate I'm getting the following error:

Post http:///var/run/docker.sock/v1.19/images/create?fromImage=codeclimate%2Fcodeclimate%3Alatest: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

When following the steps here I get:

error in run: Failed to get machine "boot2docker-vm": machine does not exist (Did you run `boot2docker init`?)`

Steps I did:

  • Install boot2docker
  • Run docker pull codeclimate/codeclimate

Thanks

Permission denied @ dir_chdir - /code (Errno::EACCES)

Installed via homebrew on osx 10.10.4.
Updated to version 0.0.22 via brew upgrade, re-ran codeclimate engines:install
Inside the project directory running codeclimate analyze I continue to get

Starting analysis
Running rubocop: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine rubocop failed with status 1 and stderr
"/usr/src/app/lib/cc/engine/rubocop.rb:16:in `chdir': Permission denied @ dir_chdir - /code (Errno::EACCES)\n\t
from /usr/src/app/lib/cc/engine/rubocop.rb:16:in `run'\n\t
from /usr/src/app/bin/codeclimate-rubocop:12:in `<main>'\n"

Timing out

I am trying out the CLI on a Rail project at work and it always times out on specific engines (i.e. rubocop and eslint). The project is somewhat large with over 50 tables and 382 JS files (to give a sense), but I imagine Code Climate can handle much larger projects. I was wondering if there is a way to increase the timeout time from 15 minutes to say 30 minutes. I would like to rule this out as a problem in my setup.

Add Engine for SCSS-Lint?

Are there any plans to add scss-lint to the engines list? csslint isn't really all that helpful as an engine in the days of LESS & SASS...it just throws a bunch of useless errors for most projects.

Docker Machine support

boot2docker has been deprecated in favour of Docker Machine. Doesn't seem to work though:

192-168-1-11.tpgi.com.au ❯❯❯ ~/Code
❯ eval "$(docker-machine env dev)"
192-168-1-11.tpgi.com.au ❯❯❯ ~/Code
❯ docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
codeclimate/codeclimate   latest              81657c6d0722        8 days ago          93.25 MB
192-168-1-11.tpgi.com.au ❯❯❯ ~/Code
❯ codeclimate
Your Docker setup does not support the codeclimate wrapper script:

  > /var/run/docker.sock must exist as a Unix domain socket

We require a local Docker daemon that supports communication via the default
socket path.

Please use `docker run' to run the `codeclimate/codeclimate' image directly.

See https://github.com/codeclimate/codeclimate for more details.

Ruby Analysis

Hi,
thanks for working on code climate and making it a great tool. I was pretty excited when I saw you open sourced a bunch of stuff a couple days ago.

Playing with code climate cli on a ruby project today I realized I can't really get the same output from the cli tool as from your cloud platform. The only ruby engine is rubocop and I can't get for example ruby class grading (A to F), complexity, duplication and security issues etc..

Those awesome code climate specific goodies are not open sourced?

Not open sourcing those is reasonable and makes complete sense from the business POV. I'm asking just to make sure I'm not somehow missing a lot of (free) value here.

Thanks and keep up the good work!

Ask user to auto-init if yml file isn't present

❯ codeclimate engines:enable eslint                                                                     12:57:39 PM
No '.codeclimate.yml' file found. Run 'codeclimate init' to generate a config file.

/Users/kevinsuttle/Code/bluemix-beta (master | ✓)
❯ codeclimate init                                                                                      12:57:43 PM
Config file .codeclimate.yml successfully generated.
Edit and then try running 'validate-config' to check configuration.

Similarly to #2, if the yml file isn't there, give the user the option to generate one interactively, on their behalf.

Same goes for "validate config". Seems like something the user shouldn't have to do.

DNS Resolution Issues in analyzers

Hello,

I ran into some issues with resolving dns when running an analyzer. Is this intended behavior? I can produce this behavior by modifying codeclimate-fixme to run a wget https://google.com which fails due to name resolution problems.

Thanks!
Steven

Add CLI option for starting boot2docker

❯ brew install codeclimate                                                                              12:34:11 PM
==> Installing codeclimate from codeclimate/homebrew-formulae
==> Downloading https://github.com/codeclimate/codeclimate/archive/v0.0.5.tar.gz
==> Downloading from: https://codeload.github.com/codeclimate/codeclimate/tar.gz/v0.0.5
######################################################################## 100.0%
==> env PATH=/usr/local/bin:/usr/local/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/sbin PREFIX=/usr/local/Cellar/codecl
which docker
/usr/local/bin/docker
docker pull codeclimate/codeclimate:latest
time="2015-06-19T12:34:47-05:00" level=fatal msg="An error occurred trying to connect: Post https://192.168.59.103:2376/v1.18/images/create?fromImage=codeclimate%2Fcodeclimate%3Alatest: dial tcp 192.168.59.103:2376: i/o timeout"
make: *** [install] Error 1
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/codeclimate/homebrew-formulae/issues


/Users/kevinsuttle
❯ boot2docker up                                                                                        12:34:50 PM
Waiting for VM and Docker daemon to start...
............oooo
Started.
Writing /Users/kevinsuttle/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/kevinsuttle/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/kevinsuttle/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.

❯ brew install codeclimate                                                                              12:40:43 PM
==> Installing codeclimate from codeclimate/homebrew-formulae
==> Downloading https://github.com/codeclimate/codeclimate/archive/v0.0.5.tar.gz
==> Downloading from: https://codeload.github.com/codeclimate/codeclimate/tar.gz/v0.0.5
Already downloaded: /Library/Caches/Homebrew/codeclimate-0.0.5-1.tar.gz
==> env PATH=/usr/local/bin:/usr/local/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/sbin PREFIX=/usr/local/Cellar/codecl
🍺  /usr/local/Cellar/codeclimate/0.0.5-1: 4 files, 16K, built in 23 seconds

Would be nice to have something interactive and in-context, like Yeoman.
http://yeoman.io/assets/img/codelab/image_1.cb4f.png

Help for subcommands

I was trying to figure out whether codeclimate analyze takes arguments.. I tried

  • codeclimate -h analyze
  • codeclimate analyze -h
  • codeclimate analyze --help

None of these gave me useful information about the analyze command.

(In particular, the project I'm running it on is large, and eslint keeps timing out, so I'd like to run codeclimate on a few sub-files, not the whole thing).

Incorrect Brew Installation Instructions

After attempting to follow your installation guide, this isn't working for me:

~ ❯❯❯ boot2docker up                                                          ⏎
Waiting for VM and Docker daemon to start...
.o
Started.
Writing /Users/kkirsche/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/kkirsche/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/kkirsche/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/kkirsche/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

~ ❯❯❯ boot2docker shellinit
Writing /Users/kkirsche/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/kkirsche/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/kkirsche/.boot2docker/certs/boot2docker-vm/key.pem
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/kkirsche/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1
~ ❯❯❯ brew install codeclimate
==> Installing codeclimate from codeclimate/homebrew-formulae
==> Downloading https://github.com/codeclimate/codeclimate/archive/v0.0.6.tar.gz
==> Downloading from: https://codeload.github.com/codeclimate/codeclimate/tar.gz
Already downloaded: /Library/Caches/Homebrew/codeclimate-0.0.6.tar.gz
==> env PATH=/usr/local/bin:/usr/local/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/
bin/check
Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
Unable to run `docker version', the docker daemon may not be running
Please ensure `boot2docker up' succeeds and you've run `boot2docker shellinit' in this shell
make: *** [install] Error 1

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/codeclimate/homebrew-formulae/issues

Excluding paths weird behavior

It looks like for any reason my exclude_paths are being ignored.

setup

This is my local setup

  • Mac OS X 10.10.3 (Yosemite)
  • boot2docker 1.7.0
  • codeclimate CLI 0.0.8 (installed the brew package)
  • bash 4.3 (this is not important it worked exactly the same with 3.2 but I had to upgrade it by other reasons)

codeclimate config

This is my .codeclimate.yml file


---
engines:
  phpcodesniffer:
    enabled: false
  coffeelint:
    enabled: true
  eslint:
    enabled: false
  csslint:
    enabled: false
ratings:
  paths:
  - "**.php"
  - "**.js"
  - "**.css"
exclude_paths:
- "node_modules/**/*"
- "vendor/**/*"
- "etc/**/*"
- ".vagrant/**/*"

I'm enabling just the coffeelint engine to reproduce it faster. Anyway, the exclude_paths should work no matter the engines, I suppose. Okay, I run composer analyze and this is the result:

codeclimate analyze
Starting analysis
Running coffeelint: Done!

== node_modules/gulp/node_modules/vinyl-fs/test/fixtures/test.coffee (1 issue) ==
1-1: [stdin]:1:12: error: unexpected !
Hello world!
           ^ [coffeelint]

Analysis complete! Found 1 issue.

That's odd. What am I missing here? Why the engine is parsing something within the node_modules folder?

Thanks

=== edited ===

I found a similar issue here codeclimate/codeclimate-csslint#1 I wonder if it is related or even the same stuff.

ERROR: brew install codeclimate

$ brew install codeclimate
==> Installing codeclimate from codeclimate/homebrew-formulae
==> Downloading https://github.com/codeclimate/codeclimate/archive/v0.0.7.tar.gz
==> Downloading from https://codeload.github.com/codeclimate/codeclimate/tar.gz/v0.0.7
######################################################################## 100.0%
Error: SHA1 mismatch
Expected: ce5efec690264565e1342b50329a03e8aa39e276
Actual: 9e2b70d12d89ba85cc0174fed5aa473b500a5f12
Archive: /Library/Caches/Homebrew/codeclimate-0.0.7.tar.gz
To retry an incomplete download, remove the file above.

Support Docker Machines not named "default"

I have updated my Mac to replace boot2docker with Docker Machine. Unfortunately it does not seem to work with the codeclimate wrapper script.

$ codeclimate                                                                                                                                                                          Your Docker setup does not support the codeclimate wrapper script:

  > /var/run/docker.sock must exist as a Unix domain socket

We require a local Docker daemon that supports communication via the default
socket path.

Please use `docker run' to run the `codeclimate/codeclimate' image directly.

See https://github.com/codeclimate/codeclimate for more details.

I do have the Docker env variables set correctly.

$ env | grep DOCKER                                                                                                                                                                  DOCKER_TLS_VERIFY=1
DOCKER_HOST=tcp://192.168.99.100:2376
DOCKER_CERT_PATH=/Users/daniel/.docker/machine/machines/docker-dev
DOCKER_MACHINE_NAME=docker-dev

"codeclimate init && codeclimate validate-config" generates an unexpected key

"codeclimate init" on a JS-heavy project generated

---
engines:
  coffeelint:
    enabled: true
  eslint:
    enabled: true
  csslint:
    enabled: true
ratings:
  paths:
  - "**.coffee"
  - "**.js"
  - "**.jsx"
  - "**.css"

I then ran codeclimate validate-config and was told:

WARNING: unexpected key "ratings", dropping

I am running version 0.0.1.

Symlink not excluding

I have a project that uses a symlink at app/Resources/node_modules, however when I exclude that path specifically in the codeclimate.yml, eslint does not seem to ignore it. instead I get this error:

error: (CC::Analyzer::Engine::EngineFailure) engine eslint failed with status 1 and stderr "fs.js:0\n(function (exports, require, module, __filename, __dirname) { // Copyright Joy\n\nError: ENOENT, no such file or directory '/code/app/Resources/node_modules'\n    at Error (native)\n    at Object.fs.statSync (fs.js:797:18)\n    at /usr/src/app/node_modules/eslint/lib/util/traverse.js:50:27\n    at Array.forEach (native)\n    at traverse (/usr/src/app/node_modules/eslint/lib/util/traverse.js:41:54)\n    at /usr/src/app/node_modules/eslint/lib/util/traverse.js:63:17\n    at Array.forEach (native)\n    at traverse (/usr/src/app/node_modules/eslint/lib/util/traverse.js:41:54)\n    at /usr/src/app/node_modules/eslint/lib/util/traverse.js:63:17\n    at Array.forEach (native)\n"

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.