diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-03-16 17:29:57 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-03-16 17:33:28 +0100 |
commit | 2b110947560917854887876ab202468fccaebdd2 (patch) | |
tree | 19a4ac5fd3e48d2c85e5e343284d2b5aec4763f2 | |
parent | ccfb41a2957432447cd21fcdba764f00b1090f15 (diff) | |
download | sonarqube-2b110947560917854887876ab202468fccaebdd2.tar.gz sonarqube-2b110947560917854887876ab202468fccaebdd2.zip |
Add new_coverage metrics to filters
6 files changed, 11 insertions, 9 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java index 4cef9962936..7b6163bd396 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java @@ -251,7 +251,6 @@ public final class CoreMetrics { .setDescription("Coverage of new/changed code") .setDirection(Metric.DIRECTION_BETTER) .setQualitative(true) - .setHidden(true) .setDomain(DOMAIN_TESTS) .setWorstValue(0.0) .setBestValue(100.0) @@ -274,7 +273,6 @@ public final class CoreMetrics { .setQualitative(false) .setDomain(DOMAIN_TESTS) .setFormula(new SumChildValuesFormula(false)) - .setHidden(true) .create(); public static final String UNCOVERED_LINES_KEY = "uncovered_lines"; @@ -290,7 +288,6 @@ public final class CoreMetrics { .setDescription("New uncovered lines") .setDirection(Metric.DIRECTION_WORST) .setDomain(DOMAIN_TESTS) - .setHidden(true) .setFormula(new SumChildValuesFormula(false)) .create(); @@ -309,7 +306,6 @@ public final class CoreMetrics { .setQualitative(true) .setWorstValue(0.0) .setBestValue(100.0) - .setHidden(true) .setDomain(DOMAIN_TESTS) .create(); @@ -331,7 +327,6 @@ public final class CoreMetrics { .setDescription("New conditions to cover") .setDomain(DOMAIN_TESTS) .setFormula(new SumChildValuesFormula(false)) - .setHidden(true) .create(); public static final String UNCOVERED_CONDITIONS_KEY = "uncovered_conditions"; @@ -347,7 +342,6 @@ public final class CoreMetrics { .setDescription("New uncovered conditions") .setDirection(Metric.DIRECTION_WORST) .setDomain(DOMAIN_TESTS) - .setHidden(true) .setFormula(new SumChildValuesFormula(false)) .create(); @@ -366,7 +360,6 @@ public final class CoreMetrics { .setDescription("Branch coverage of new/changed code") .setDirection(Metric.DIRECTION_BETTER) .setQualitative(true) - .setHidden(true) .setDomain(DOMAIN_TESTS) .setWorstValue(0.0) .setBestValue(100.0) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb index 0ebc8b8be8f..672eb3683a4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb @@ -146,6 +146,7 @@ class ResourceController < ApplicationController @display_violations=true @global_violations=[] @expandable=(@lines!=nil) + @filtered=!@expanded conditions='snapshot_id=?' values=[@snapshot.id] @@ -206,6 +207,7 @@ class ResourceController < ApplicationController def filter_lines_by_date if @period + @filtered=true to=@snapshot.period_datetime(@period) if to @lines.each do |line| diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb index febcdd9127d..82b677a33e6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb @@ -61,7 +61,7 @@ class TimemachineController < ApplicationController measures.each do |measure| next unless measure.metric - if measure.metric.timemachine? + if measure.metric.timemachine? && measure.value row=rows_by_metric_id[measure.metric_id] unless row row=Sonar::TimemachineRow.new(measure.metric) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 44232d80298..af3bb857f53 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -232,6 +232,7 @@ module ApplicationHelper # * <tt>:url</tt> - add an url on the measure. # * <tt>:prefix</tt> - add a prefix. Default is ''. # * <tt>:suffix</tt> - add a suffix. Default is ''. + # * <tt>:period</tt> - period index, from 1 to 5. Optional. Default is nil. # * <tt>:default</tt> - text to return if metric or measure not found. Default is blank string. # # === Examples diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb index 6da915f8c1b..dccb0e81d9d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb @@ -40,7 +40,7 @@ <table id="drilldown" class="width100"> <% if @highlighted_metric!=@metric %> <tr> -<td colspan="<%= @drilldown.columns.size -%>">Drilldown on <b><span id="m_<%= u @metric.key -%>"><%= @snapshot.f_measure(@metric.key) -%></span> <%= @metric.short_name -%></b></td> +<td colspan="<%= @drilldown.columns.size -%>">Drilldown on <b><%= format_measure(@metric.key, :period => @period) -%> <%= @metric.short_name -%></b></td> </tr> <tr> <% end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb index 1f51b7c26c7..bb9383f2b17 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb @@ -22,11 +22,13 @@ colspan+=2 if @display_coverage previous_hidden=false first_section=true + has_displayed_lines=false @lines.each_with_index do |line, index| if line.hidden previous_hidden=true next end + has_displayed_lines=true if previous_hidden && !first_section current_revision=nil @@ -93,4 +95,8 @@ </tr> <% end %> </table> + + <% if @filtered && !has_displayed_lines %> + <p>No lines match your filter criteria.</p> + <% end %> <% end %>
\ No newline at end of file |