]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3081 "Violations" widget shows the number of "new violations"
authorFabrice Bellingard <bellingard@gmail.com>
Fri, 20 Jan 2012 10:44:54 +0000 (11:44 +0100)
committerFabrice Bellingard <bellingard@gmail.com>
Fri, 20 Jan 2012 10:44:54 +0000 (11:44 +0100)
And links it to the drilldown service using the correct metric to
easily find new violations.

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 8db7c377ff8a344b39562e81949ecb74fa137bab..e0a4b23d8c6bd7e3a07146c38623f88f124b9fe6 100644 (file)
@@ -2,22 +2,30 @@
   violations=@snapshot.measure('violations')
   density=@snapshot.measure('violations_density')
   blocker_violations = @snapshot.measure('blocker_violations')
-       critical_violations = @snapshot.measure('critical_violations')
-       major_violations = @snapshot.measure('major_violations')
-       minor_violations = @snapshot.measure('minor_violations')
-       info_violations = @snapshot.measure('info_violations')
+  critical_violations = @snapshot.measure('critical_violations')
+  major_violations = @snapshot.measure('major_violations')
+  minor_violations = @snapshot.measure('minor_violations')
+  info_violations = @snapshot.measure('info_violations')
+  new_violations=@snapshot.measure('new_violations')
 %>
 <table width="100%">
   <tr>
     <td valign="top">
-                 <div class="dashbox">
-                   <h3><%= message('widget.rules.violations') -%></h3>
-                         <div class="marginbottom10">
-                           <span class="big">
-                             <%= format_measure(violations, :url => url_for(:controller => 'drilldown', :action => 'violations', :id => @project.key)) -%>
-                           </span>
-                           <%= dashboard_configuration.selected_period? ? format_variation(violations) : trend_icon(violations) -%>
-                         </div>
+      <div class="dashbox">
+        <h3><%= message('widget.rules.violations') -%></h3>
+        <div class="marginbottom10">
+            <span class="big">
+              <%= 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>
+            <% end %>
+        </div>
         <h3><%= message('widget.rules.rules_compliance') -%></h3>
         <div>
           <span class="big">
@@ -25,8 +33,9 @@
           </span>
           <%= dashboard_configuration.selected_period? ? format_variation(density) : trend_icon(density) -%>
         </div>
-                 </div>
-               </td>
+      </div>
+    </td>
+    
                <td valign="top" nowrap>
                        <%
         values=[blocker_violations,critical_violations,major_violations,minor_violations,info_violations]
index 00435931bb270e5d1ad51fa5298498453a295eb3..c6363a34c7a1c314cb822927c809a8a0ff236613 100644 (file)
@@ -639,6 +639,7 @@ widget.rules.name=Rules Compliance
 widget.rules.description=Reports violations and compliance index on coding standards.
 widget.rules.violations=Violations
 widget.rules.rules_compliance=Rules compliance
+widget.rules.on_new_code=On new code:
 
 widget.size.name=Size metrics
 widget.size.description=Reports general metrics on the size of the project.