Getting the code quality only when pushing to a git repository requiring code quality check can be quite exhausting. While I struggled with this for a while, I then found a way using docker following this documentation but it didn’t seem to work. Finally got it to working and decided to document the steps I used for anyone who needs it.
- Install and setup using Docker for mac
- Pull code climate image to your machine using
docker pull codeclimate/codeclimate
- To support this installation, code climate package is installed using the commands
brew tap codeclimate/formulae
brew install codeclimateOther operating systems:
curl -L https://github.com/codeclimate/codeclimate/archive/master.tar.gz | tar xvz
cd codeclimate-* && sudo make install
Copy the command script below and save to a file named
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
bin folder making it global:
sudo mv codeclimate.sh /usr/local/bin/codeclimate
Change the access right to make the script runnable using:
cd /usr/local/bin/ && sudo chmod 755 codeclimate
codeclimate on the terminal location containing
codeclimate can be written to a file using
codeclimate > ../filename.html
More commands for customization of the shell script can be found here.
Thanks for stopping by and I do hope you found this article somewhat helpful 😉.