Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
{iframe:src=http://update.sonarsource.org/plugins/toxicitychart.html|width=700|height=250|frameborder=0} Your browser does not support iframes. {iframe}
Wiki Markup
Warning
titleDeprecated

This plugin is deprecated since SonarQube 3.7. Please move to the concept of Technical Debt introduced in SonarQube 4.0.

Description / Features

This Sonar Plugin plugin is an implementation of the Toxicity Chart visualization technique presented by Erik Dörnenburg on his blog. This technique is very useful to quickly get an idea about of the general quality of the a large existing code base. Toxicity Charts stack multiple static analysis metrics for classes, methods, or components within an application, providing a combined "toxicity" score for each area of the code base. This can be extremely useful in helping managers and non-developers understand the internal quality of the code

...

In a Toxicity Chart each bar represents a class and the height of the bar shows the toxicity score for that class.  The score is based on 11 rules (see Usage & Installation section) and different colours are used to represent each one. This makes it possible to easily spot not only how toxic a code base is, but also how the problems are distributed and what the preponderant "code smell" is. The classes that score zero points are left off the chart. The metrics are computed using the threshold value set for corresponding Checkstyle rule.

...

Axes of quality

All the metrics are computed using the approach presented above.

File Length

Total of points accumulated due to the violation of Checkstyle File Length rule. The possible associated technical debts are: Understandability, Maintainability and Single Responsibility Principle violation.

Method Length

Total of points accumulated due to the violation of Checkstyle Method Length rule. The possible associated technical debts are: Understandability, Maintainability and Single Responsibility Principle violation.

Cyclomatic Complexity

Total of points accumulated due to the violation of Checkstyle Cyclomatic Complexity rule. The possible associated technical debts are: Understandability, Maintainability and Testability.

Parameter Number

Total of points accumulated due to the violation of Checkstyle Parameter Number rule. The possible associated technical debts are: Understandability, Maintainability and Testability.

Boolean Expression Complexity

Total of points accumulated due to the violation of Checkstyle Boolean Expression Complexity rule. The possible associated technical debts are: Understandability, Maintainability and Testability.

Nested If Depth

Total of points accumulated due to the violation of Checkstyle Nested If Depth rule. The possible associated technical debts are: Understandability, Maintainability and Testability.

Nested Try Depth

Total of points accumulated due to the violation of Checkstyle Nested Try Depth rule. The possible associated technical debts are: Understandability, Maintainability and Testability.

Missing Switch Default

Total of points accumulated due to the violation of Checkstyle Missing Switch Default rule. The possible associated technical debt is: Correctness.

Class Fan Out Complexity

Total of points accumulated due to the violation of Checkstyle Class Fan out Complexity rule. The possible associated technical debts are: Understandability, Maintainability, Testability and High Coupling.

Class Data Abstraction Coupling

Total of points accumulated due to the violation of Checkstyle Class Data Abstraction Coupling rule. The possible associated technical debts are: Understandability, Maintainability, Testability and High Coupling.

Anon Inner Length

Total of points accumulated due to the violation of Checkstyle Anon Inner Length rule. The possible associated technical debt is: Maintainability.

Average value

Total of points accumulated due violation of all above rules divided by the number of classes that score more than one point.

Anchor
ToxicityChartConfiguration
ToxicityChartConfiguration

Usage & Installation
  • Copy the jar into /extensions/plugins/ directory
  • Restart Sonar Web server
  • Check on Quality Profile page if the below Checkstyle Rules are enabled and

    Include Page
    Include - Plugin Installation
    Include - Plugin Installation

    Usage

    1. Make sure the Checkstyle Rules listed below are enabled in your profile and that the threshold values are set appropriateappropriately.
    2. Launch a new quality analysis and to calculate the metrics will be fed.

    The table below lists the Checkstyle Squid rules that should be enabled in order to generate the Toxicity Chart. The threshold values are just suggestions and they can be modified to fit the desired Quality Profile. The deprecated Checkstyle Rules still apply, however, the Squid Rules are highly recommended.

     

    Checkstyle Rule (deprecated )Squid Rule (highly recommended)LevelThreshold
    File LengthS00104file500
    Method LengthS138method30
    Cyclomatic ComplexityMethodCyclomaticComplexitymethod10
    Parameter NumberS00107method7
    Boolean Expression ComplexityS1067statement3
    Nested If DepthS134statement3
    Nested Try DepthS1141statement2
    Missing Switch DefaultSwitchLastCaseIsDefaultCheckstatement-
    Class Fan Out ComplexityS1200class30
    Class Data Abstraction Coupling-class10
    Anon Inner LengthS1188inner class35

     

    If the number of classes that score more than one point is greater than 125, then the numbers on the X axis will overlap each other. In order to make the chart readable in this situation the Toxicity Chart threshold value can be changed in Configuration > General Settings > Toxicity Chart panel. The classes that have the score below the threshold value are left off the chart. The threshold value is not taken into account in toxicity metrics computing.
     

    Known Limitations

    Only Java projects are supported.

    Change Log

    JIRA Issues
    anonymoustrue
    titleTC Version 0.1
    height70
    renderModestatic
    width950900
    columnstype;key;summary;priority;status;resolution
    urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+SONARPLUGINS+AND+component+%3D+%22Toxicity+Chart%22+ORDER+BY+priority+DESC&tempMax=1000

    ...