Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
SonarQube
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<table class="wysiwyg-macro" data-macro-name="unmigrated-inline-wiki-markup" data-macro-parameters="atlassian-macro-output-type=BLOCK" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e3VubWlncmF0ZWQtaW5saW5lLXdpa2ktbWFya3VwOmF0bGFzc2lhbi1tYWNyby1vdXRwdXQtdHlwZT1CTE9DS30&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>{iframe:src=http://update.sonarsource.org/plugins/toxicitychart.html|width=700|height=250|frameborder=0} Your browser does not support iframes. {iframe}</pre></td></tr></table><h1>Description / Features</h1><p>This plugin is an implementation of <strong>Toxicity Chart</strong> visualization technique presented by Erik Dörnenburg on his <a href="http://erik.doernenburg.com/2008/11/how-toxic-is-your-code/">blog</a>. This technique is very useful to quickly get an idea about the general quality of the large existing code base. <strong>Toxicity Charts</strong> 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</p><p><img class="confluence-embedded-image confluence-external-resource" src="https://lh5.googleusercontent.com/-THhht10Rbrg/UIkpZGlZqGI/AAAAAAAAAiM/cOG0Ja36cck/s721/toxicity_chart.png" data-image-src="https://lh5.googleusercontent.com/-THhht10Rbrg/UIkpZGlZqGI/AAAAAAAAAiM/cOG0Ja36cck/s721/toxicity_chart.png"></p><p>In a <strong>Toxicity Chart</strong> 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 <a class="confluence-link" href="#ToxicityChartConfiguration" data-anchor="ToxicityChartConfiguration" data-linked-resource-default-alias="ToxicityChartConfiguration" data-base-url="http://docs.codehaus.org">Usage & Installation</a> 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.</p><p><img class="confluence-embedded-image confluence-external-resource" src="https://lh3.googleusercontent.com/-si6O8lb0k-E/UIksu1HAK-I/AAAAAAAAAi0/6fYk-DKOc2g/s754/method_length_rule.png" data-image-src="https://lh3.googleusercontent.com/-si6O8lb0k-E/UIksu1HAK-I/AAAAAAAAAi0/6fYk-DKOc2g/s754/method_length_rule.png"></p><p>For example if the Method Length metric has a threshold of <strong>30</strong> and a class comprises three methods, one that is <strong>25</strong> lines, one that is <strong>45</strong> lines and another that is <strong>60</strong> lines long, then the score is calculated to be proportional to the length of the method in relation to the threshold and for the given scenario the class gets <strong>1.5 + 2 = 3.5</strong> points.</p><div><h1>Axes of quality</h1><p>All the metrics are computed using the approach presented above.</p><h5>File Length</h5><p>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.</p><h5>Method Length</h5><p>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.</p><h5>Cyclomatic Complexity</h5><p>Total of points accumulated due to the violation of Checkstyle Cyclomatic Complexity rule. The possible associated technical debts are: Understandability, Maintainability and Testability.</p><h5>Parameter Number</h5><p>Total of points accumulated due to the violation of Checkstyle Parameter Number rule. The possible associated technical debts are: Understandability, Maintainability and Testability.</p><h5>Boolean Expression Complexity</h5><p>Total of points accumulated due to the violation of Checkstyle Boolean Expression Complexity rule. The possible associated technical debts are: Understandability, Maintainability and Testability.</p><h5>Nested If Depth</h5><p>Total of points accumulated due to the violation of Checkstyle Nested If Depth rule. The possible associated technical debts are: Understandability, Maintainability and Testability.</p><h5>Nested Try Depth</h5><p>Total of points accumulated due to the violation of Checkstyle Nested Try Depth rule. The possible associated technical debts are: Understandability, Maintainability and Testability.</p><h5>Missing Switch Default</h5><p>Total of points accumulated due to the violation of Checkstyle Missing Switch Default rule. The possible associated technical debt is: Correctness.</p><h5>Class Fan Out Complexity</h5><p>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.</p><h5>Class Data Abstraction Coupling</h5><p>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.</p><h5>Anon Inner Length</h5><p>Total of points accumulated due to the violation of Checkstyle Anon Inner Length rule. The possible associated technical debt is: Maintainability.</p><h5>Average value</h5><p>Total of points accumulated due violation of all above rules divided by the number of classes that score more than one point.</p><h1><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2FuY2hvcjpUb3hpY2l0eUNoYXJ0Q29uZmlndXJhdGlvbn0&locale=en_GB&version=2" data-macro-name="anchor" data-macro-default-parameter="ToxicityChartConfiguration">Installation</h1><ol><li>Install the plugin through the <a href="http://docs.codehaus.org/display/SONAR/Update+Center" rel="nofollow">Update Center</a> or download it into the <em>SONARQUBE_HOME/extensions/plugins</em> directory</li><li>Restart the SonarQube server</li></ol><h1>Usage</h1><ol><li>Check on Quality Profile page if the below Checkstyle Rules are enabled and the threshold values are set appropriate</li><li>Launch a new quality analysis and the metrics will be fed</li></ol><p>The table below lists the Checkstyle rules that should be <strong>enabled</strong> in order to generate the <strong>Toxicity Chart</strong>. The threshold values are just suggestions and they can be modified to fit the desired Quality Profile.</p><p> </p><table class="confluenceTable"><tbody><tr><th class="confluenceTh">Checkstyle Rule</th><th class="confluenceTh">Level</th><th class="confluenceTh">Threshold</th></tr><tr><td class="confluenceTd">File Length</td><td class="confluenceTd">file</td><td class="confluenceTd">500</td></tr><tr><td class="confluenceTd">Method Length</td><td class="confluenceTd">method</td><td class="confluenceTd">30</td></tr><tr><td class="confluenceTd">Cyclomatic Complexity</td><td class="confluenceTd">method</td><td class="confluenceTd">10</td></tr><tr><td class="confluenceTd">Parameter Number</td><td class="confluenceTd">method</td><td class="confluenceTd">7</td></tr><tr><td class="confluenceTd">Boolean Expression Complexity</td><td class="confluenceTd">statement</td><td class="confluenceTd">3</td></tr><tr><td class="confluenceTd">Nested If Depth</td><td class="confluenceTd">statement</td><td class="confluenceTd">3</td></tr><tr><td class="confluenceTd">Nested Try Depth</td><td class="confluenceTd">statement</td><td class="confluenceTd">2</td></tr><tr><td class="confluenceTd">Missing Switch Default</td><td class="confluenceTd">statement</td><td class="confluenceTd">-</td></tr><tr><td class="confluenceTd">Class Fan Out Complexity</td><td class="confluenceTd">class</td><td class="confluenceTd">30</td></tr><tr><td class="confluenceTd">Class Data Abstraction Coupling</td><td class="confluenceTd">class</td><td class="confluenceTd">10</td></tr><tr><td class="confluenceTd">Anon Inner Length</td><td class="confluenceTd">inner class</td><td class="confluenceTd">35</td></tr></tbody></table><p> </p></div><div>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 <strong>Toxicity Chart</strong> threshold value can be changed in <em>Configuration > General Settings > Toxicity Chart panel</em>. 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.</div><div> </div><div><img class="confluence-embedded-image confluence-external-resource" src="https://lh6.googleusercontent.com/-i61P0DyHLNY/UIks5uI4f4I/AAAAAAAAAjM/4O8DQOpVttA/s684/toxicity_chart_settings.png" data-image-src="https://lh6.googleusercontent.com/-i61P0DyHLNY/UIks5uI4f4I/AAAAAAAAAjM/4O8DQOpVttA/s684/toxicity_chart_settings.png"></div><h1>Known Limitations</h1><p>Only Java projects are supported.</p><h1>Change Log</h1><div><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2ppcmFpc3N1ZXM6YW5vbnltb3VzPXRydWV8dGl0bGU9VmVyc2lvbiAwLjF8aGVpZ2h0PTcwfHJlbmRlck1vZGU9c3RhdGljfHdpZHRoPTkwMHxjb2x1bW5zPXR5cGU7a2V5O3N1bW1hcnk7cHJpb3JpdHl8dXJsPWh0dHA6Ly9qaXJhLmNvZGVoYXVzLm9yZy9zci9qaXJhLmlzc3Vldmlld3M6c2VhcmNocmVxdWVzdC14bWwvdGVtcC9TZWFyY2hSZXF1ZXN0LnhtbD9qcWxRdWVyeT1wcm9qZWN0KyUzRCtTT05BUlBMVUdJTlMrQU5EK2NvbXBvbmVudCslM0QrJTIyVG94aWNpdHkrQ2hhcnQlMjIrT1JERVIrQlkrcHJpb3JpdHkrREVTQyZ0ZW1wTWF4PTEwMDB9&locale=en_GB&version=2" data-macro-name="jiraissues" data-macro-parameters="anonymous=true|columns=type;key;summary;priority|height=70|renderMode=static|title=Version 0.1|url=http://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|width=900"></div><p> </p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced