Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

Sonar provides this historical information through two features: Historical information are provided through the Time Machine and the Tendencies

...

The Time Machine is made of two generic widgets that can be instantiated and configured in any dashboard.

Timeline Widget

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.

...

Note
titleThe Timeline is not displayed at package level by default

By default, historical information is not kept on directories/packages and therefore the timeline has not value to display. This can be changed by logging in as an administrator, going to Settings > Configuration > General Settings > Database Cleaner and setting the Clean history data of directories/packages property to truefalse. This will increase the volume of data to be stored in the database.

...

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: 

Default Dashboard

Info
titleAvailabe since Sonar 3.0.

 

A default Time Machine dashboard comes out-of-the-box when installing Sonar. This is a combination of Timeline and History Table widgets:

Tendencies

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?

Sonar uses 5 levels to describe the tendency of a measure. Each level is represented by an arrow:

...

There are five different levels of tendency

Image Added

Strong increase

Image RemovedImage Added

Medium increase

 

Neutral

Image RemovedImage Added

Medium decrease

Image RemovedImage Added

Strong decrease

Sonar uses black ( Image Removed) arrows Black arrows are used to represent tendencies on the quantitative metrics (the ones that are does not reflecting reflect quality of the code, for example number of lines of code). 
Sonar uses red ( Image Removed)
Red or green Image Removed) arrows are used to represent tendencies on the qualitative metrics (the ones that are reflecting reflects 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 in green by Image Removed because it is considered as an improvement.

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 Sonar implements a more advanced algorithm is implementedthe least squares method. The least squares It is a linear regression analysis that helps removing the noise in order to determine a trend on discrete measures. In other words, Sonar takes all the measure taken in the last XX days , checks that are taken into account, then the set of measures is checked to see if ti makes some sense (by testing the correlation rate), determines and an estimated slope is computed and displays it displayed using the arrows. 

Info

It is to be noted that the algorithm currently considers that measures are taken at a constant frequency


It is possible to configure the tendencies by logging in as an administrator and going to Configuration Settings > Configuration > General Settings > Differential Views.

  • To activate/deactivate the computation of tendencies, set the Skip tendencies property to true/false. Default is true.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.

Note
titleAbout deleting snapshots

Deleting a snapshot is a 2-step process:

  • The snapshot must first be removed from the project history by clicking on "Delete snapshot". It won't be displayed anymore on this "History" page but will still be present in the database.
  • Then the snapshot is really deleted during the next project analysis.

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

House Cleaning

Removing Useless Data

When you do ryun a new analysis of your project, some data that were present in Sonar will not be accessible anymore. For previously availabet will no longer be (for example the source code of the previous analysis, measures at file level, etc.). . Those These data will automatically be removed at the end of a new analysis.

Removing

...

Unnecessary Analyses

This is very useful to frequently analyze frequently a project in Sonar to see progress on 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. Therefore, since Sonar 2.5, a new "Database Cleaner" has been added to Sonar. It 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:

  • it deletes all All data older than 5 years it keeps a single monthly analysis by project old are deteleted
  • For each project:
    • only one analysis per month is kept over 1 year
    it keeps a single weekly analysis by project
    • only one analysis per week is kept over 1 month
    analysis with an event are
    • 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 in the page at Settings > Configuration > General Settings > Database Cleaner.

Image Removed

Removing Ghost Projects

See Bulk Deletion documentation page.