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.