When looking at the code quality of an application and willing to decide of an action plan, it is sometimes not sufficient to get a snapshot of the quality at a given time. You also need some visibility on the application history to take the right decision.
For example, let's say that you have defined a requirement that each application should have a coverage by unit tests of 60%. And let's say that one of you application has got 50% coverage. Without historical data, you can only conclude that the team does not write sufficient unit tests and that it should become the next focus of attention. But let's now say that a couple of months ago the coverage for this application was 20%... then you would probably conclude that although the requirement is not made yet, the team is doing a very good job and that no special focus needs to be put on unit tests. This is why having access to historical information is important.
Historical information are provided through the Time Machine and the Tendencies.
The Time Machine
The Time Machine is made of two generic widgets that can be instantiated and configured in any dashboard.
The Timeline widget provides the capability to display a chart containing historical data of up to 3 metrics. Passing your mouse over the timeline will display the different values.
This widget can be customized:
History Table Widget
The History Table widget provides the capability to display a table with the historical data up to 10 metrics:
This widget can be customized:
A default Time Machine dashboard comes out-of-the-box. This is a combination of Timeline and History Table widgets:
What are Tendencies?
The tendencies are arrows that are displayed next to metrics in the dashboards. Those arrows show the trend for the measure.
How to Read Tendencies?
There are five different levels of tendency
Black arrows are used to represent tendencies on the quantitative metrics (the ones that does not reflect quality, for example number of lines of code).
Red or green arrows are used to represent tendencies on the qualitative metrics (the ones that reflects quality, for example code coverage). The red is used when the quality decreases, the green when it increases.
How are Tendencies Calculated?
To compute the tendencies, making a simple difference between the last two measures of each metric would not be accurate enough. Therefore a more advanced algorithm is implemented: the least squares method. It is a linear regression analysis that helps removing the noise in order to determine a trend on discrete measures. In other words, all the measure in the last XX days are taken into account, then the set of measures is checked to see if ti makes some sense (by testing the correlation rate), and an estimated slope is computed and displayed using arrows.
It is possible to configure the tendencies by logging in as an administrator and going to Settings > Configuration > General Settings > Differential Views.
- To configure the number of days used to compute tendencies, set the Tendency period property to the desired number of days. Default is 30.
Whatever the reason (wrong quality profile, issue with analysis, etc.), it is possible to remove a snapshot to polish the Time Machine widgets. Note that the last snapshot can never be deleted.
At project level, go to Configuration > History.
For every snapshot, it is possible to manually:
- Add, rename or remove a version
- Add, rename or remove an event
Two types of event are automatically logged:
- Profile: flag a snapshot as soon as a new quality profile or an updated quality profile is used to analyze this snapshot
- Alert: to flag a snapshot as soon as an alert has been raised
Removing Useless Data
When you ryun a new analysis of your project, some data that were previously availabet will no longer be (for example the source code of the previous analysis, measures at file level, etc.). These data will automatically be removed at the end of a new analysis.
Removing Unnecessary Analyses
This is very useful to frequently analyze a project to see how quality evolves. It is also very useful to be able to see the trends over weeks, months, years. But when you are back in time, you do not really need the same level of details as you would for one week ago. The Database Cleaner aims to delete some rows in the database to save some space and to improve overall performances. Here is its default configuration:
- All data older than 5 years old are deteleted
- For each project:
- only one analysis per month is kept over 1 year
- only one analysis per week is kept over 1 month
- only one analysis per day is kept over 1 day
- All closed issues more than 30 days old are deleted
- History at package/directory level is not kept
These settings can be changed at Settings > Configuration > General Settings > Database Cleaner.