CodeClimate is Awesome

CodeClimate is an automated code review tool for Ruby and JavaScript and is an awesome tool for writing good code.  The software analyzes your GitHub repo and assigns the code a “grade” from A to F.  Problematic areas of your codebase are flagged which allows refactoring efforts to be focused where they are needed the most.

Code Grading Algorithm

CodeClimate gives bad scores to methods with duplicate code or a lot of complexity (i.e. lots of conditional logic, variable assignments, etc.).  The scoring algorithm is harsh and has no problem giving a method with duplicate code or very complex methods a C, D, or F grade.  In my experience, CodeClimate’s assessment on code quality is almost always accurate (i.e. when they complain that a method is too complex, they are always right).  No one wants bad code grades, so CodeClimate forces you to rethink the problem and write better code that is deserving of a higher grade.

Change in Code Grades for Branches 

CodeClimate also lets you check for changes in code quality for a branch before merging it with master.  If you are disciplined and fix all code quality issues before merging with master, technical debt will not accumulate.  Applications have a tendency to start out great and gradually get crappier as more people work on them and the codebase gets larger – fixing code quality issues before merging with master is the best way to mitigate the decline in code quality.

Free for Open Source Projects

CodeClimate is free for open source, so add this to your favorite Ruby / Rails app and enjoy the harsh criticisms.  Just today, my pair was about to add some duplicate code, and I told him we have to refactor or will get punished by CodeClimate.  We rethought the problem, solved it in a better way, and the crappy duplicate code will never touch master.


One thought on “CodeClimate is Awesome

  1. Pingback: Good Code Is Better Than Bad Code With Tests | Ruby/Rails Programming

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s