|Table of content|
Since Sonar 2.4, a "Filters" service has been added as the home page. The main objective of this service is to respond to a maximum of questions without needing to drill down to secondary pages. Here are some use cases covered by this service :
- List my favourite projects
- List the worst projects from the desired perspectives : technical debt, code coverage, duplications, ...
- List the modules of a project
- List the most complex files
- List the longest unit test files
From there, you can click on any resource to drilldown to this resource.
My favourites tab
This tab is displayed only when a user is logged into Sonar and list all resources, whatever they are projects, modules, packages or files, that have been flagged as favourite by the user :
A resource can be flagged as favourite by simply clicking on a star icon available on the Dashboard of any project, module or package:
or on any component on the Components page:
or at file level:
This tab is available and displayed by default for all Sonar users on any new Sonar instance. As expected, this page displays all available projects. This table as any other tables can be sorted by clicking on a column header.
Creating a new filter
Creating a new filter requires to be logged in and then to click on the "Add filter" button:
A creation filter form has then to be filled:
Here's the list of all the available fields:
Name of the filter.
This option is only available for user with global admin role. Those administrators can share some filters with all Sonar users.
Filter mechanism to display only resources sharing a root path.
Filter mechanism to display only resources having a given type.
Filter mechanism to display only resources whose a given measure is greater than or less than a threshold. Up to three criteria can be defined.
Filter mechanism to display only resources from a given language
Filter mechanism to display only favourites
Resource key like
Filter mechanism to display only resources whose key matches a given pattern
Resource name like
Filter mechanism to display only resources whose name matches a given pattern
Filter mechanism to display only resources according to their last build date
Once a filter has been defined, two actions are available :
- "Save & Close" : to save the current filter and come back to the "view" mode
- "Save & Display" : to save the current filter, stay in the "edit" mode, customize the "Display" and start seeing the filter result.
Since Sonar 2.5, a new service has been added to Filters to view the changes that occurred on measures during a pre-defined period. Configuration of this service is documented here.
To activate this service, pick the desired period in the drop down list "Time changes..."
This is done by choosing whether to add value or change when adding a column
The default period can be configured
Note that variations cannot be displayed at file level (as all previous data are purged at file level during an analysis).
Editing a filter
Once a filter has been created, it can be edited at anytime by clicking on the "Edit filter" button :
Once several filters have been created, it becomes necessary to:
- Order these filters in the Sonar web interface
- Quickly delete or edit some of them
- Follow/unfollow some shared filters
These features are available by clicking on the "Manage filters" button :
Managing default filters
Once logged in, users can fully customize their filters and administrators can also fully customize the default filters available for any new Sonar users or for anonymous users. The "Default filters" service allows to do such things :