The new "Filters" functionality added in Sonar 2.2

by freddy mallet|

    Prior to Sonar 2.2, the home page was simply the list of projects under quality control. Beyond the fact that it did not add much value to the platform, it was unreadable with more than 100 projects and could not even load with more than 800 projects ! This is why we switched the default Sonar home page from an "All Projects" service to a "Filters" service in Sonar 2.2.



    The new service can support any size of projects portfolio with powerful capabilities for filtering and paginating information. What we call a "Filter" is a tab in the Sonar home page which displays chosen quality measures (complexity, violations, code coverage, ...) on chosen resources (views, sub-views, projects, packages, directories, files, classes and unit tests). Of course, you can create as many of those filters as you need. Here are the configuration options when creating a filter :


    The Filters service can be configured by every user of the instance as soon as he is logged in. An administrator can also create and share filters across users. To make sure we cover all cases, we have also added the ability to configure the default filters for the instance to provide the same experience to anonymous users.

    Let's now describe sone use cases covered by this new service.

    Follow favorite resources


    If your company is making an intensive usage of the platform, the projects you want to monitor can quickly get lost among hundreds or thousands other projects. Once you are logged in to Sonar, you now can flag those projects and have them displayed in a filter. You can actually go further than this and flag any kind of resource as a favorite one.

    Once a resource is flagged, it gets automatically displayed in the “My Favourites” filter :


    Organizing projects



    One of the most obvious use case of the Filters service is to group similar projects to be able to compare them : by language, by team, by technology... Not only this is easy to do, but also highly maintainable with the ability to use regexp on projects keys to select projects to display. Do not forget that filters can always be applied to each kind of resources. Combined with the ability to choose a root for the filter, you can also choose to display for example all packages of the project that is currently under the spot lights.

    Offering a high-level entry point


    Combining the Filters service with the Views plugin enables to get an entry point that is a high level perspective on the project portfolio. For instance you could imagine to have the home page that becomes a list of projects representing the Lines Of Businesses.

    Exposing breaks in requirement


    When you make a decision to monitor the quality of source code, there are generally 2 prerequisites :

    • A tool (Sonar of course)
    • A set of requirements (no more that 3% duplication on a single package, no blocker violation...)


    You can enter those information in a filter that will then expose resources that do not follow those requirements. This is exactly the role of tool such as Sonar : acting as a radiator to show hot and cold spots on quality of the source code.

    Automated action plans


    Every developer can now use filters to get a quality action plan. He can get a list of files in his applications that are at risk and would greatly contribute to improve quality if they were fixed. For example the files that have the most uncovered complexity by unit tests, files that have most duplicated lines...

    This is now time to let you go and configure you home page ! You can browse the documentation for more information.