]> source.dussan.org Git - sonarqube.git/commitdiff
Add new_coverage metrics to filters
authorsimonbrandhof <simon.brandhof@gmail.com>
Wed, 16 Mar 2011 16:29:57 +0000 (17:29 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Wed, 16 Mar 2011 16:33:28 +0000 (17:33 +0100)
sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb

index 4cef9962936a85f2a6062cd69b4e13d2655aa80a..7b6163bd396ece07a538199d94c1765f74baab4b 100644 (file)
@@ -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)
index 0ebc8b8be8f4bef86b2f718d10b857074d92190b..672eb3683a46ea8bf51d4af1da0077fbf936ff1d 100644 (file)
@@ -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|
index febcdd9127d488cfc558cd8a1539f4b05f6ff69e..82b677a33e6670c96720c98c56637f1699c740a8 100644 (file)
@@ -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)
index 44232d802986313161426a7cd206449e68262268..af3bb857f5391b1f11c517377bb183b79abc77b4 100644 (file)
@@ -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
index 6da915f8c1b19df247ad699b9a2534aaa21e365f..dccb0e81d9d9ab99a955acc48350634b496c796b 100644 (file)
@@ -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
index 1f51b7c26c74628a053210829279c513ecf59072..bb9383f2b174249ff24576d0c0b87e456a116a6a 100644 (file)
     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