aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-07-10 16:32:34 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-07-10 17:14:19 +0200
commita60f1b7cfff19b3d1837b423bad858e4d8818192 (patch)
treee77308bd9cb0ead0546062c548a514f7874a2b6d
parent22d7d2f0e0c8d239eb6b56408ff385688b143b85 (diff)
downloadsonarqube-a60f1b7cfff19b3d1837b423bad858e4d8818192.tar.gz
sonarqube-a60f1b7cfff19b3d1837b423bad858e4d8818192.zip
SONAR-4346 Fix regressions on documentation & comments widget
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties1
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb34
2 files changed, 24 insertions, 11 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
index c5a4b3ef0ab..0fdefad9584 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
@@ -899,6 +899,7 @@ widget.documentation_comments.lines.suffix=\ lines
widget.documentation_comments.docu_api.suffix=\ docu. API
widget.documentation_comments.undocu_api.suffix=\ undocu. API
widget.documentation_comments.public_api.suffix=\ Public API
+widget.documentation_comments.blank.suffix=\ blank
widget.duplications.name=Duplications
widget.duplications.description= Reports on copy/paste and code duplications
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb
index 6cdc14165ac..8890a5116b7 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb
@@ -1,6 +1,11 @@
<%
- comments=measure('comment_lines_density')
- if comments
+ if measure(Metric::LINES) || measure(Metric::NCLOC)
+ public_api=measure('public_api')
+ public_documented_api_density=measure('public_documented_api_density')
+ public_undocumented_api=measure('public_undocumented_api')
+ comment_lines=measure('comment_lines')
+ comment_lines_density=measure('comment_lines_density')
+ comment_blank_lines=measure('comment_blank_lines')
%>
<table width="100%">
<tbody>
@@ -10,17 +15,17 @@
<p class="title"><%= message('widget.documentation_comments.documentation') -%></p>
<p>
<span class="big">
- <%= format_measure(measure('public_documented_api_density'),:url => url_for_drilldown('public_documented_api_density'), :suffix => ' ' + message('widget.documentation_comments.docu_api.suffix'))%>
+ <%= format_measure(public_documented_api_density, :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY), :suffix => message('widget.documentation_comments.docu_api.suffix'))%>
</span>
<%= dashboard_configuration.selected_period? ? format_variation('public_documented_api_density') : trend_icon('public_documented_api_density') -%>
</p>
<p>
- <%= format_measure(measure('public_api'),:url => url_for_drilldown('public_api'), :suffix => ' ' + message('widget.documentation_comments.public_api.suffix'))%>
- <%= dashboard_configuration.selected_period? ? format_variation('public_api') : trend_icon('public_api') -%>
+ <%= format_measure(public_api,:url => url_for_drilldown(public_api), :suffix => message('widget.documentation_comments.public_api.suffix'))%>
+ <%= dashboard_configuration.selected_period? ? format_variation(public_api) : trend_icon(public_api) -%>
</p>
<p>
- <%= format_measure(measure('public_undocumented_api'),:url => url_for_drilldown('public_undocumented_api'), :suffix => ' ' + message('widget.documentation_comments.undocu_api.suffix'))%>
- <%= dashboard_configuration.selected_period? ? format_variation('public_undocumented_api') : trend_icon('public_undocumented_api') -%>
+ <%= format_measure(public_undocumented_api,:url => url_for_drilldown(public_undocumented_api), :suffix => message('widget.documentation_comments.undocu_api.suffix'))%>
+ <%= dashboard_configuration.selected_period? ? format_variation(public_undocumented_api) : trend_icon(public_undocumented_api) -%>
</p>
</div>
</td>
@@ -29,14 +34,21 @@
<p class="title"><%= message('widget.documentation_comments.comments') -%></p>
<p>
<span class="big">
- <%= format_measure('comment_lines_density',:url => url_for_drilldown('comment_lines_density'))%>
+ <%= format_measure(comment_lines_density,:url => url_for_drilldown(comment_lines_density))%>
</span>
- <%= dashboard_configuration.selected_period? ? format_variation('comment_lines_density') : trend_icon('comment_lines_density') -%>
+ <%= dashboard_configuration.selected_period? ? format_variation(comment_lines_density) : trend_icon(comment_lines_density) -%>
</p>
<p>
- <%= format_measure(measure('comment_lines'),:url => url_for_drilldown('comment_lines'), :suffix => ' ' + message('widget.documentation_comments.lines.suffix'))%>
- <%= dashboard_configuration.selected_period? ? format_variation('comment_lines') : trend_icon('comment_lines') -%>
+ <%= format_measure(measure(comment_lines),:url => url_for_drilldown(comment_lines), :suffix => message('widget.documentation_comments.lines.suffix'))%>
+ <%= dashboard_configuration.selected_period? ? format_variation(comment_lines) : trend_icon(comment_lines) -%>
</p>
+ <%
+ if comment_blank_lines && comment_blank_lines.value>0
+ %>
+ <p>+<%= format_measure(comment_blank_lines, :suffix => message('widget.documentation_comments.blank.suffix'), :url => url_for_drilldown(comment_blank_lines)) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(comment_blank_lines) : trend_icon(comment_blank_lines) -%>
+ </p>
+ <% end %>
</div>
</td>
</tr>