]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6159 drop the most violated rules widget
authorStas Vilchik <vilchiks@gmail.com>
Thu, 5 Mar 2015 13:00:14 +0000 (14:00 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 5 Mar 2015 13:00:14 +0000 (14:00 +0100)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMostViolatedRulesWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_rules.html.erb [deleted file]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index e3f95633802bc58fcdce1be523188a105ea466f7..5edf693e8b697f1e9a4d86ffbe0f9ce0a333a997 100644 (file)
@@ -256,7 +256,6 @@ public final class CorePlugin extends SonarPlugin {
       // issues
       CountUnresolvedIssuesDecorator.class,
       CountFalsePositivesDecorator.class,
-      HotspotMostViolatedRulesWidget.class,
       MyUnresolvedIssuesWidget.class,
       FalsePositiveIssuesWidget.class,
       ActionPlansWidget.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMostViolatedRulesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMostViolatedRulesWidget.java
deleted file mode 100644 (file)
index 27b3821..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets;
-
-import org.sonar.api.web.WidgetCategory;
-import org.sonar.api.web.WidgetProperties;
-import org.sonar.api.web.WidgetProperty;
-import org.sonar.api.web.WidgetPropertyType;
-
-@WidgetCategory("Hotspots")
-@WidgetProperties(
-{
-  @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5"),
-  @WidgetProperty(key = "defaultSeverity", type = WidgetPropertyType.SINGLE_SELECT_LIST, defaultValue = "", options = {"INFO", "MINOR", "MAJOR", "CRITICAL", "BLOCKER"})
-})
-public class HotspotMostViolatedRulesWidget extends CoreWidget {
-  public HotspotMostViolatedRulesWidget() {
-    super("hotspot_most_violated_rules", "Most violated rules", "/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_rules.html.erb");
-  }
-}
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_rules.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_rules.html.erb
deleted file mode 100644 (file)
index d30b7b7..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<%
-   limit = widget_properties["numberOfLines"]
-   metric_prefix = dashboard_configuration.selected_period? ? 'new_' : ''
-   value_column = (dashboard_configuration.selected_period? ? "variation_value_#{dashboard_configuration.period_index}" : 'value')
-   measures_by_severity = {}
-   all_measures=[]
-
-   Severity::KEYS.each do |key|
-     rule_measures = @snapshot.rule_measures(Metric.by_key("#{metric_prefix}#{key.downcase}_violations"))
-     sorted_measures = rule_measures.select { |a|
-       val = a.send(value_column)
-       val && val>0
-     }.sort { |a, b| b.send(value_column) <=> a.send(value_column) }[0...limit]
-     measures_by_severity[key] = sorted_measures
-     all_measures.concat(sorted_measures)
-   end
-   measures_by_severity['all']=all_measures.sort { |a, b| b.send(value_column) <=> a.send(value_column) }[0...limit]
-
-   default_severity = widget_properties['defaultSeverity']
-   default_severity = 'all' unless Severity::KEYS.include?(default_severity)
-%>
-
-<script type="text/javascript">
-  function showMostViolatedRules<%= widget.id -%>(severity) {
-    $j('#block_<%= widget.id-%> div.hotspot').hide();
-    $j('#most-violated-rules-<%= widget.id -%>-' + severity).show();
-  }
-
-  function severityForLink() {
-    var severity = $j('#select-severity_<%= widget.id -%>').val();
-    if (severity == 'all') {
-      return '';
-    } else {
-      return severity;
-    }
-  }
-</script>
-
-<div class="line-block">
-  <div style="float:right">
-    <a class="underlined-link" href="#" onclick="window.location.href='<%= url_for(:controller => 'drilldown', :action => 'issues') -%>/<%= @resource.id -%>?period=<%= dashboard_configuration.period_index -%>&severity=' + severityForLink() ">
-      <%= message('widget.hotspot_metric.more') -%>
-    </a>
-  </div>
-  <h3>
-    <%= message(dashboard_configuration.selected_period? ? 'widget.hotspot_most_violated_rules.name_when_period' : 'widget.hotspot_most_violated_rules.name') %>
-
-    <select class="small withIcons" style="margin-left: 20px" onchange="showMostViolatedRules<%= widget.id -%>(this.value);" id="select-severity_<%= widget.id -%>">
-      <option value="all" <%= 'selected' if default_severity=='all' -%>><%= message('widget.hotspot_most_violated_rules.any_severity') -%></option>
-      <% Severity::KEYS.each do |key| %>
-        <option class="sev_<%= key -%>" value="<%= key -%>" <%= 'selected' if default_severity==key -%>><%= message("severity.#{key}") -%></option>
-      <% end %>
-    </select>
-
-    <script>
-      $j(function() {
-        $j('#select-severity_<%= widget.id -%>').select2({ width: '130px' });
-      });
-    </script>
-  </h3>
-</div>
-
-
-<div>
-  <%
-     measures_by_severity.each do |severity, measures|
-       if measures.empty?
-  %>
-
-      <div id="most-violated-rules-<%= widget.id -%>-<%= severity -%>" class="hotspot" style="padding-top:10px">
-        <span class="empty_widget"><%= message('widget.hotspot_most_violated_rules.no_violation_for_severity') -%></span>
-      </div>
-
-    <%
-       else
-    %>
-
-      <div id="most-violated-rules-<%= widget.id -%>-<%= severity -%>" class="hotspot">
-        <table class="data">
-          <thead>
-          <tr>
-            <th colspan="3"></th>
-          </tr>
-          </thead>
-          <tbody>
-          <%
-             max_value = measures.first.send(value_column)
-             measures.each do |m|
-               rule = m.rule
-               value = m.send(value_column)
-          %>
-            <tr class="<%= cycle 'even', 'odd', :name => ("hotspot_most_violated_rules-#{widget.id}-#{severity}") -%>">
-              <td class="thin">
-                <i class="icon-severity-<%= m.severity.downcase -%>"></i>
-              </td>
-              <td>
-                <%= h rule.name -%>
-              </td>
-              <td class="right nowrap">
-                <a class="underlined-link <%= widget.key %>_<%= rule.key.parameterize %>" href="<%= url_for(:controller => 'drilldown', :action => 'issues', :id => @resource.key, :rule => rule.key, :rule_sev => m.severity, :period => dashboard_configuration.period_index) -%>">
-                  <%= dashboard_configuration.selected_period? ? format_variation(m) : format_measure(m) -%>
-                </a>
-              </td>
-              <td class="barchart">
-                <div class="barchart" style="width: <%= (value*100/max_value).round.to_i -%>%">
-                  <div style="width: 100%;"></div>
-                </div>
-              </td>
-            </tr>
-          <%
-             end
-          %>
-          </tbody>
-        </table>
-      </div>
-
-    <%
-       end
-       end
-    %>
-</div>
-<script type="text/javascript">
-  showMostViolatedRules<%= widget.id -%>("<%= default_severity -%>");
-</script>
index 50d835b52cfa3c205378cf2b0aa45a3137a5ed41..4936f3e60c796079baf4c3b1e0033da9d7a4ed39 100644 (file)
@@ -1323,15 +1323,6 @@ widget.hotspot_metric.property.title.name=Title
 widget.hotspot_metric.property.metric.name=Metric
 widget.hotspot_metric.property.numberOfLines.name=Number of lines
 
-widget.hotspot_most_violated_rules.name=Most Violated Rules
-widget.hotspot_most_violated_rules.name_when_period=Most new violated rules
-widget.hotspot_most_violated_rules.description=Shows the rules that are the most violated.
-widget.hotspot_most_violated_rules.no_violation_for_severity=No result
-widget.hotspot_most_violated_rules.any_severity=Any severity
-widget.hotspot_most_violated_rules.property.numberOfLines.name=Number of lines
-widget.hotspot_most_violated_rules.property.defaultSeverity.name=Default severity
-widget.hotspot_most_violated_rules.property.defaultSeverity.desc=If selected, severity used to initialize the dropdown list of widget
-
 widget.my_reviews.name=My Unresolved Issues
 widget.my_reviews.description=Shows unresolved issues assigned to the current user.
 widget.my_reviews.property.numberOfLines.name=Number of lines