Tendencies in Sonar
One of the very good feature in Sonar is the tendencies. The tendencies are visible in every screen, from portfolio to class view, and are materialized by little arrows next to each measure. Those arrows show the trend for the measure.
This blog entry intends to explain how to read them, how Sonar makes their calculation and how they can be used.
Sonar uses 5 levels to describe the tendency of a measure. Each level is represented by an arrow :
Sonar uses black() arrows to represent tendencies on the quantitative metrics (the ones that are not reflecting quality of the code, for example number of lines of code).
Sonar uses red() or green() arrows to represent tendencies on the qualitative metrics (the ones that are reflecting quality of the code, for example code coverage). The red is used when the quality decreases, the green when it increases.
Of course, it is to be noted that if the percentage of duplicated lines decreases it will be represented by because it is considered as an improvement.
In order to display the tendencies, we decided that making a simple difference between the last two measures of each metrics was not accurate enough. Therefore we implemented a more advanced algorithm : the least squares method. The least squares is a linear regression analysis that helps removing the noise in order to determine a trend on discrete measures.
In other words, Sonar takes the last X measures, checks that the set of measures make some sens (by testing the correlation rate), determines an estimated slope and displays it using the arrows.
Since Sonar uses the last X snapshots, you would expect this X is configurable: that is the case ! Simply sign in, go to preferences -> measures menu. The number of days there is not really a number of days, but in fact a number of snapshots that are going to be used. You can increase this number as much as you like, as long as you have enough snapshots in you database !
Where do we get from there? If you take measure at a regular frequency, it means that you are able to get weekly, monthly tendencies, ... on all your pages within Sonar.