aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-03-07 15:09:59 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-03-07 15:09:59 +0100
commit3f1a93b472a4ed1503714403146ef22b69b1efa6 (patch)
treeb099e7d2efd88db6f51c052eb523edce6a416b26 /plugins
parent25bce57233fba27331723f70e1d36c6ab24ce655 (diff)
downloadsonarqube-3f1a93b472a4ed1503714403146ef22b69b1efa6.tar.gz
sonarqube-3f1a93b472a4ed1503714403146ef22b69b1efa6.zip
SONAR-2218 improve rendering of coverage widget
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb110
1 files changed, 60 insertions, 50 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb
index 6110cdac682..dd0a2ed7656 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb
@@ -1,8 +1,8 @@
<%
- code_coverage_measure=measure(Metric::COVERAGE)
- tests_measure=measure(Metric::TESTS)
- execution_time=measure(Metric::TEST_EXECUTION_TIME)
- success_percentage=measure(Metric::TEST_SUCCESS_DENSITY)
+ code_coverage_measure=measure('coverage')
+ tests_measure=measure('tests')
+ execution_time=measure('test_execution_time')
+ success_percentage=measure('test_success_density')
if code_coverage_measure || tests_measure
%>
@@ -12,44 +12,65 @@
<div class="dashbox">
<p class="title">Code coverage</p>
<p>
- <span class="big"><%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown(Metric::COVERAGE), :default => '-') %></span>
+ <span class="big"><%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown('coverage'), :default => '-') %></span>
<%= dashboard_configuration.selected_period? ? format_variation(code_coverage_measure) : trend_icon(code_coverage_measure) -%>
</p>
- <% line_coverage=measure(Metric::LINE_COVERAGE)
+ <% line_coverage=measure('line_coverage')
if line_coverage %>
<p>
<%= format_measure(line_coverage, :suffix => ' line coverage', :url => url_for_drilldown('uncovered_lines', :highlight => 'line_coverage')) %>
<%= dashboard_configuration.selected_period? ? format_variation(line_coverage) : trend_icon(line_coverage) -%>
</p>
<% end %>
- <% branch_coverage=measure(Metric::BRANCH_COVERAGE)
+ <% branch_coverage=measure('branch_coverage')
if branch_coverage %>
<p>
<%= format_measure(branch_coverage, :suffix => ' branch coverage', :url => url_for_drilldown('uncovered_conditions', :highlight => 'branch_coverage')) %>
<%= dashboard_configuration.selected_period? ? format_variation(branch_coverage) : trend_icon(branch_coverage) -%>
</p>
<% end %>
- <p>
- <%= format_measure(tests_measure, :suffix => ' tests', :url => url_for_drilldown(Metric::TESTS)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(tests_measure) : trend_icon(tests_measure) -%>
- </p>
- <% skipped_measure=measure(Metric::SKIPPED_TESTS)
- if dashboard_configuration.selected_period? || (skipped_measure && skipped_measure.value && skipped_measure.value>0)
+
+ <%
+ if dashboard_configuration.selected_period?
+ new_lines_to_cover_measure=measure('new_lines_to_cover')
+ if new_lines_to_cover_measure
+ new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
+ if new_lines
+ new_coverage=measure('new_coverage')
+ new_line_coverage=measure('new_line_coverage')
+ new_branch_coverage=measure('new_branch_coverage')
+ %> <br/>
+ <h3>On new/changed code:</h3>
+ <% if new_lines.to_i>0 %>
+ <% if new_coverage %>
+ <p>
+ <span class="big"><a href="<%= url_for_drilldown('new_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_coverage.format_numeric_value(variation_value(new_coverage))||'-' -%></a></span> coverage
+ </p>
+ <% end %>
+ <p>
+ <%= new_lines.to_i -%> new lines to cover
+ </p>
+ <% if new_line_coverage %>
+ <p>
+ <a href="<%= url_for_drilldown('new_uncovered_lines', :highlight => 'new_line_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_line_coverage.format_numeric_value(variation_value(new_line_coverage))||'-' -%></a> line coverage
+ </p>
+ <% end %>
+ <% if new_branch_coverage %>
+ <p>
+ <a href="<%= url_for_drilldown('new_uncovered_conditions', :highlight => 'new_branch_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_branch_coverage.format_numeric_value(variation_value(new_branch_coverage))||'-' -%></a> branch coverage
+ </p>
+ <%
+ end
+ end
+ end
+ end
+ end
%>
- <p>
- +<%= format_measure(skipped_measure, :suffix => ' skipped', :url => url_for_drilldown(Metric::SKIPPED_TESTS), :default => '0') %>
- <%= dashboard_configuration.selected_period? ? format_variation(skipped_measure) : trend_icon(skipped_measure) -%>
- </p>
- <% end %>
- <p>
- <%= format_measure(execution_time, :suffix => '', :url => url_for_drilldown(Metric::TEST_EXECUTION_TIME)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(execution_time) : trend_icon(execution_time) -%>
- </p>
</div>
</td>
<td valign="top" width="50%" nowrap>
<%
- if success_percentage
+ if tests_measure
%>
<div class="dashbox">
<h3>Test success</h3>
@@ -65,6 +86,22 @@
<%= format_measure(Metric::TEST_ERRORS, :suffix => ' errors', :url => url_for_drilldown(Metric::TEST_ERRORS)) %>
<%= dashboard_configuration.selected_period? ? format_variation(Metric::TEST_ERRORS) : trend_icon(Metric::TEST_ERRORS) -%>
</p>
+ <p>
+ <%= format_measure(tests_measure, :suffix => ' tests', :url => url_for_drilldown('tests')) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(tests_measure) : trend_icon(tests_measure) -%>
+ </p>
+ <% skipped_measure=measure(Metric::SKIPPED_TESTS)
+ if dashboard_configuration.selected_period? || (skipped_measure && skipped_measure.value && skipped_measure.value>0)
+ %>
+ <p>
+ +<%= format_measure(skipped_measure, :suffix => ' skipped', :url => url_for_drilldown(Metric::SKIPPED_TESTS), :default => '0') %>
+ <%= dashboard_configuration.selected_period? ? format_variation(skipped_measure) : trend_icon(skipped_measure) -%>
+ </p>
+ <% end %>
+ <p>
+ <%= format_measure(execution_time, :suffix => '', :url => url_for_drilldown('test_execution_time')) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(execution_time) : trend_icon(execution_time) -%>
+ </p>
</div>
<% end %>
</td>
@@ -73,30 +110,3 @@
<% end %>
-<%
-if dashboard_configuration.selected_period?
- new_lines_to_cover_measure=measure('new_lines_to_cover')
- if new_lines_to_cover_measure
- new_lines=new_lines_to_cover_measure.variation(dashboard_configuration.period_index)
- if new_lines
- new_coverage=measure('new_coverage')
- new_line_coverage=measure('new_line_coverage')
- new_branch_coverage=measure('new_branch_coverage')
-%>
- <h3>on changed code (<%= new_lines.to_i -%> new lines to cover)</h3>
- <p>
- <% if new_coverage %>
- Coverage: <a href="<%= url_for_drilldown('new_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_coverage.format_numeric_value(variation_value(new_coverage)) -%></a><br/>
- <% end %>
- <% if new_line_coverage %>
- Line coverage: <a href="<%= url_for_drilldown('new_uncovered_lines', :highlight => 'new_line_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_line_coverage.format_numeric_value(variation_value(new_line_coverage)) -%></a><br/>
- <% end %>
- <% if new_branch_coverage %>
- Branch coverage: <a href="<%= url_for_drilldown('new_uncovered_conditions', :highlight => 'new_branch_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_branch_coverage.format_numeric_value(variation_value(new_branch_coverage)) -%></a>
- <% end %>
- </p>
-<%
- end
- end
-end
-%> \ No newline at end of file