Sonar 2.0 in screenshots

by simon brandhof|

    The Sonar team is very proud to announce Sonar 2.0, the first release of 2010. As announced in a previous post, the main feature in Sonar 2.0 consists of analyzing Design : Architecture and object oriented metrics. This enables to report on the "7th deadly sin of the developer" that was missing so far in Sonar. As a reminder, here are the first six deadly sins : low coverage by unit tests, bad complexity distribution, potential bugs, duplicated code, lack of comments and non respect of coding standards.

    As it is now a tradition, here is a presentation of the new features in screenshots. Enjoy !


    When talking about architecture the first priority is to remove cycles between packages by cutting undesired dependencies. That might sound like an evidence but among all well-known java projects continuously analyzed and available in Nemo, very few of them don't have any cycle. The cycle concept is just a familiar entry point into Sonar which leads to more powerful information : how many dependencies between packages should be cut in order to remove all cycles ? How tangled is the overall architecture ? How many links between files do those dependencies represent ?
    (Design widget)
    From the project dashboard, clicking on any above 'architecture' metrics, leads to a new visual tool : The DSM (Dependency Structure Matrix). DSM is a compact way to represent and navigate across dependencies between components. Depending on the navigation level, those components can be Maven modules, packages or files. Wants to know more about the DSM ? Here is the DSM user guide.
    (Dependency Structure Matrix)

    Object-Oriented Metrics

    All Chidamber & Kemerer metrics are now available in Sonar : DIT, NOC, RFC, CA, CE, LCOM4. The most interesting Object Oriented metric is certainly LCOM4 (Lack of Cohesion of Methods) which can be used to hunt classes undertaking too many responsibilities.
    (Object Oriented Metrics)
    Let's take a simple example : a class whose LCOM4=3 means that 3 different blocks of methods/fields are fully unrelated and so the class is not cohesive. Of course this is possible to visualize those blocks into the resource viewer :
    (Lack of Cohesion of Methods)

    UI Improvements

    Perfection is often a matter of detail, so new icons are now displayed into the Sonar interface to quickly know the type of each component :
    (New icons)
    Last but not least, all the underlying mechanisms used to extract dependencies graph from Bytecode, compute object-oriented metrics, create and sort the DSM, target dependencies to cut have been fully implemented in Squid by the Sonar team. This will allow to provide new features like dead code detection, calls to deprecated methods, architecture rules engine in future Sonar versions.

    To find out more about Sonar 2.0 and the 50 issues that have been fixed, you can read the release note or maybe you prefer to download it to give a ride !