We know that agile teams are self-organized. That is, we don’t have the figure of a head that checks and controls all the members of his team are doing. Thus, the responsibility for the quality of code being produced is entirely of development team. But how to do this with agile? How to support the development team in this task? In today's post we present SONAR, a tool to support the development team by generating dynamic reports that provide feedback about the quality of code that is being produced.
On the day-by-day of software development, how many times we find codes with no comments and difficult to understand? How often we find codes that are beyond the patterns adopted in the project? How many hours (or even days) dispense with bugs that could be solved with simple changes in the code? These are some common situations in software projects, especially in big teams, in which is even more difficult to control the code that is being developed. In agile methods, it is neither a control issue, since the team is self-organized. It is a development support issue. How to support the developer so that he can always produce a good code? What about using Sonar?!
Sonar is an open source tool used to evaluate the quality of the code being developed. Architecture issues, duplicate code, points of potential bugs, complexity level and test coverage are evaluated by Sonar in order to give the team a feedback about the quality of the code.
Sonar can be configured to store all the information of the code in a database so you can also do a follow up of the evolution of code quality. Figure 1 shows a screen generated by Sonar, that shows a map of the general code status of the involved projects.
Figure 1: General map of projects
The user can select the type of evaluation he wants. For example, display the percentage of duplicated code in each project. The closer to the green, the higher the quality of the project in the type of assessment selected. The user can also select one of the projects (rectangles in Figure 1) to view detailed information of the corresponding project. In Figure 2 we present more detailed information of the selected project.
Figure 2: Detailed view of a project
One way to use the Sonar is integrating it with a service of continuous integration (CI) to automate the generation of the reports assessing the quality of the code. An interesting way would be to program the CI server to daily call to Sonar and produce a report of projects in order to give a daily feedback to the team about the quality of they are developing. Or sending a report for every commit to the repository code. This way, developers can quickly acquire knowledge about the team’s technical debts and take the necessary actions to correct the problem.
To respond as soon as possible is important to maintain the quality of the software being developed and always ensure quality deliveries. As mentioned earlier, the generation of reports Sonar can be integrated into continuous integration service of a project, such as Jenkins. Access the "Jenkins Plugin"for details about how to integrate these two tools.
In today's post we presented a way to support the development team to maintain the quality of their work. Using Sonar integrated into a continuous integration service is possible to give a quick return to the developer about the quality of his code.
The daily feedback is agile, since it allows the team become aware of what needs to be improved as soon as possible, providing quality deliveries to the client.
And you? What does your development team to maintain the quality of their code?
boa tarde. muito bom artigo, mas… sou iniciante neste esquema do sonar, então, caso possível, gostaria de um passo-a-passo, para avaliar meu código com o sonar, e como integrá-lo ao jenkins, desde já agradeço o apoio.