A Home-built alternative to Code Climate

Code Climate is a good product. I used it at a company I worked for before. But then again, I’m cheap, and I’m a nerd. So I built my own and integrated it with my own Jenkins server, and have it run code check on each pull request on my GitHub repo. I’d spend the extra money on marketing.

So here it goes.

Since the setup uses the Jenkins pull request builder, and I already have a build project for RSpec using the plugin, so I created a new project copying from that project. You can see how I setup the RSpec build project to run for each pull request / commit here.

The only difference is the build steps:

cd /var/lib/jenkins/workspace/Code_Quality_PROD/
rvm use 2.3.0
gem install bundler
bundle install --deployment --path vendor/bundle
bundle exec rubocop

And that’s it! At the end of the run, rubocop will return a standard exit code from 0–2.

If your company already has funding or a positive income, I strongly recommend you to pay for and use Code Climate. It provides much more than just running rubocop, it gives you suggestions how to organize your code, best practices and so on. So this is just a first step, I plan to integrate more code-checking tools into it later.

(Optional) UI improvement

You can also set these up for it to display nicely on GitHub

When you create a pull request on GitHub, you will see:

Good luck and have fun! Leave me a comment below if you have any question.