]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3081 Add cleared violations count on the "Rules" widget
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 25 Jan 2012 10:32:44 +0000 (11:32 +0100)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 25 Jan 2012 10:32:44 +0000 (11:32 +0100)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties

index e0a4b23d8c6bd7e3a07146c38623f88f124b9fe6..29e61001f837377f875039ac9e3c9d0aa9636518 100644 (file)
               <%= format_measure(violations, :url => url_for(:controller => 'drilldown', :action => 'violations', :id => @project.key)) -%>
             </span>
             <%= dashboard_configuration.selected_period? ? format_variation(violations) : trend_icon(violations) -%>
-            <% if @dashboard_configuration.selected_period? %>
-              <br/>
-              <span style="font-weight: bold">
-                <%= message('widget.rules.on_new_code') -%>
-                <a href="<%= url_for_drilldown('new_violations', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_violations, :style => 'none', :default => '-') -%></a>
-              </span>
+            <% 
+               if @dashboard_configuration.selected_period?
+                 violations_variation = variation_value(violations)
+                 new_violations_variation = variation_value(new_violations)
+                 estimated_cleared_violations = (violations_variation - new_violations_variation).to_i if violations_variation && new_violations_variation
+            %>
+              <% if new_violations_variation && new_violations_variation > 0 %>
+                <br/>
+                <span style="font-weight: bold">
+                  <%= message('widget.rules.on_new_code') -%>&nbsp;
+                  <a href="<%= url_for(:controller => 'drilldown', :action => 'violations', :id => @project.key, :period => dashboard_configuration.period_index) -%>" class="varw"><%= format_variation(new_violations, :style => 'none', :default => '-') -%></a>
+                </span>
+              <% end %>
+              <% if estimated_cleared_violations && estimated_cleared_violations < 0 %>
+                <br/>
+                <span style="font-weight: bold">
+                  <%= message('widget.rules.on_old_code') -%>&nbsp;
+                  <span class="varb"><%= estimated_cleared_violations -%></span>
+                </span>
+              <% end %>
             <% end %>
         </div>
         <h3><%= message('widget.rules.rules_compliance') -%></h3>
index 225d92f67eda31743f2206e38eb64d90b4fa644e..65ea811bc4247eec13070b83cc7ccd374a3ac73c 100644 (file)
@@ -641,6 +641,7 @@ widget.rules.description=Reports violations and compliance index on coding stand
 widget.rules.violations=Violations
 widget.rules.rules_compliance=Rules compliance
 widget.rules.on_new_code=On new code:
+widget.rules.on_old_code=On old code:
 
 widget.size.name=Size metrics
 widget.size.description=Reports general metrics on the size of the project.