Improve the code quality of your automated tests with Code Climate.

Bruno Batista
automation with batista
4 min readNov 17, 2018

What is Code Climate? And what does he do?

Code Climate was created by Bryan Helmkamp, ​​a well-known ruby developer in the community for contributions in several open source projects, including Rails itself and libraries that were already used a long time ago as webrat.

Is a static quality analysis tool for your code. What it does is nothing more than scanning all your code looking for duplication problems, code smells and other assorted problems. Serving of a mini code review of your code and improving the quality of the code.

Code Climate supports the following languages:

JavaScript,PHP,Python,Ruby,Java e em breve Object-C ,Go e Swift.
it’s amazing!

How to integrate with your project?

1-Step

Sign up for the code climate, I suggest registering with the Github account.

2- Step

Add your repository that wants to use the code climate.

3-Step

Soon after the code climate will run its process checking all your code, depending on the size of the code can take a while.

After reading all your code it will go to main screen where it will say that your code has code smells, duplicates and problems of various types. It will also give you a note F, E, D, C, B, A, where F is a lot bad(Give up that area kkkk), and A (You're a ninja developer!).

A more detailed example of when the code smells, duplicates and problems. In this project the code climate is complaining of 4 code smells to see the image below, to see that my methods are going from 25 lines, in my first code smells has 39 lines in the method. This is quite wrong, right? The code climate also gives an average of how many hours it takes to refactor the code.

With these examples you will know where you have a problem in your code, then just do the refactoring, then commit it will run in your code and check the refactoring and will upload your note as an example below:

You can also configure what you want the code climate to see in your code or not, for this you just need to create a codeclimate.yml file in your project and put the settings as in the example below:

very good!

Since I use code climate then do not I need to do Code Review of my code any more?

Of course it is! The code climate it only does the review of the structure of your code, it does not validate if you implemented what really had to be done in that sprint, if you applied design patterns, it is very important to have the review of your friends because only them know what you had to do in functionality. Code climate will help you have a better code and organized.

So after that post would you put it all into practice and make it a cleaner, more organized code?

Bye.

References:

--

--