From: Fabrice Bellingard Date: Wed, 25 Jan 2012 10:32:44 +0000 (+0100) Subject: SONAR-3081 Add cleared violations count on the "Rules" widget X-Git-Tag: 2.14~246 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fa9087b12224debec5f79cad71719ccb952775b7;p=sonarqube.git SONAR-3081 Add cleared violations count on the "Rules" widget --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb index e0a4b23d8c6..29e61001f83 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb @@ -18,12 +18,26 @@ <%= format_measure(violations, :url => url_for(:controller => 'drilldown', :action => 'violations', :id => @project.key)) -%> <%= dashboard_configuration.selected_period? ? format_variation(violations) : trend_icon(violations) -%> - <% if @dashboard_configuration.selected_period? %> -
- - <%= message('widget.rules.on_new_code') -%> - <%= format_variation(new_violations, :style => 'none', :default => '-') -%> - + <% + 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 %> +
+ + <%= message('widget.rules.on_new_code') -%>  + <%= format_variation(new_violations, :style => 'none', :default => '-') -%> + + <% end %> + <% if estimated_cleared_violations && estimated_cleared_violations < 0 %> +
+ + <%= message('widget.rules.on_old_code') -%>  + <%= estimated_cleared_violations -%> + + <% end %> <% end %>

<%= message('widget.rules.rules_compliance') -%>

diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 225d92f67ed..65ea811bc42 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -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.