Local Analysis with Code Climate via Docker on Ubuntu 16.04

I began working with Code Climate, which is also the first time I have worked with docker. I am using Ubuntu 16.04, and I followed the Docker install guide. After install, nothing would run. I soon realized I needed to sudo everything involving Docker

The Code Climate README file is pretty straight forward. Simply copy the usage command

sudo 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 analyze

into a bash shell codeclimate.sh. I called mine codeclimate.sh. For ease of use you can mv that to a local bin

sudo mv codeclimate.sh /usr/local/bin/codeclimate

Now I can simply run the command codeclimate from any directory with a .codeclimate.yml file and get an analysis of my code. I could even pip it to an html file codeclimate > ../out.html


LinkedInGitHubTwitter