Do you know that feeling when you see a code and ask yourself: „Oh my God, who wrote this bad code?“ And after browsing through history you see the unpleasant truth – the author is you. It is nothing strange; we learn every day, and we have new and better ideas which we can refactor.
If you work on some proof of concept application, or something for learning – you probably have the luxury of infinite changes. But unfortunately for application developers, in the real world there are deadlines and spending too much time on refactoring is not an option.
In addition, if you work on a bigger project and in bigger teams, you know how hard it is to have code style consistency. It can be very difficult to understand your colleague’s code and continue the work.
A very useful tool to solve these problems is SonarQube.
SonarQube is an automatic code review tool to detect bugs, vulnerabilities, and code smells in your code.
The idea of this article is not to describe how to use SonarQube – this would require a whole book. SonarQube has too many highly useful things for one blog article. You have a project in two or more different languages – no problem, SonarQube works with many of the most popular programming languages.
How to use SonarQube?
For example, you have pushed you work, but you forgot to validate a part of your code on NullPointerException. It happens. But on the SonarQube portal you get a message about this and are asked to refactor, like in the following picture.
As said before, a whole book is required to describe SonarQube. Nevertheless, use it in your development process. Your developers will write cleaner, more secure codes, and they will be better developers.
Your code will be better, easier, and cheaper to maintain. And at the end, one of the most important things – your client will be satisfied.