]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5950 ignore issue measures
authorStas Vilchik <vilchiks@gmail.com>
Fri, 6 Feb 2015 15:58:49 +0000 (16:58 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 6 Feb 2015 15:58:58 +0000 (16:58 +0100)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb
server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb

index bd8cdd9482e19ac1d4b96090b97667514adcfbcf..4a4ea3e3341c8a3c4fc3a4543f19979f7e05c9a5 100644 (file)
@@ -47,7 +47,8 @@
       error_measure = ProjectMeasure.new :metric => condition_metric, :value => error_value
 
       is_difference_measure = condition_metric.name.start_with?('new_')
-      is_not_difference_measure_with_period = !is_difference_measure && !period.blank?
+      is_issue_measure = get_issue_metrics.include? condition_metric.name
+      is_not_difference_measure_with_period = !is_difference_measure && !period.blank? && !is_issue_measure
 
 
       unless level == 'OK' && !widget_properties['show_ok']
index 3ec5c8606369d3981d0b921d8c6f640456f7168b..cebf88db8fe1a43d7e4281a93475103d4ebff844 100644 (file)
@@ -87,17 +87,17 @@ module ApplicationHelper
   # shortcut for the method is_admin?() without parameters. Result is kept in cache.
   def administrator?
     @is_administrator ||=
-      begin
-        is_admin?
-      end
+        begin
+          is_admin?
+        end
   end
 
   # shortcut for the method has_role?(:profileadmin). Result is kept in cache.
   def profiles_administrator?
     @is_profileadmin ||=
-      begin
-        has_role?(:profileadmin)
-      end
+        begin
+          has_role?(:profileadmin)
+        end
   end
 
   def qualifier_icon(object)
@@ -195,10 +195,7 @@ module ApplicationHelper
       metric_key = metric_or_measure
     end
 
-    issues_metrics = ['violations',
-                      'blocker_violations', 'critical_violations', 'major_violations', 'minor_violations', 'info_violations',
-                      'new_blocker_violations', 'new_critical_violations', 'new_major_violations', 'new_minor_violations', 'new_info_violations',
-                      'open_issues', 'reopened_issues', 'confirmed_issues', 'false_positive_issues']
+    issues_metrics = get_issue_metrics
 
     if issues_metrics.include? metric_key
       resource = options[:resource]||@resource.key
@@ -321,7 +318,6 @@ module ApplicationHelper
   end
 
 
-
   #
   #
   # link to the current page with the given resource. If file, then open a popup to display resource viewers.
@@ -618,11 +614,11 @@ module ApplicationHelper
     min_length=options[:min_length]
 
     js_options={
-      'minimumInputLength' => min_length,
-      'allowClear' => options[:allow_clear]||false,
-      'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}",
-      'formatSearching' => "function(){return '#{escape_javascript message('select2.searching')}'}",
-      'formatInputTooShort' => "function(term, minLength){return '#{escape_javascript message('select2.tooShort', :params => [min_length])}'}"
+        'minimumInputLength' => min_length,
+        'allowClear' => options[:allow_clear]||false,
+        'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}",
+        'formatSearching' => "function(){return '#{escape_javascript message('select2.searching')}'}",
+        'formatInputTooShort' => "function(term, minLength){return '#{escape_javascript message('select2.tooShort', :params => [min_length])}'}"
     }
     js_options['placeholder']= "'#{options[:placeholder]}'" if options.has_key?(:placeholder)
     js_options['width']= "'#{width}'" if width
@@ -786,8 +782,8 @@ module ApplicationHelper
     width=options[:width]||'250px'
     html_id=options[:html_id]||name
     js_options={
-      'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}",
-      'width' => "'#{width}'"
+        'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}",
+        'width' => "'#{width}'"
     }
 
     select_tag_prompt=nil
@@ -849,8 +845,8 @@ module ApplicationHelper
     minimumResultsForSearch=show_search_box ? 0 : option_tags.size + 1
 
     js_options={
-      'minimumResultsForSearch' => minimumResultsForSearch,
-      'allowClear' => options[:allow_clear]||false,
+        'minimumResultsForSearch' => minimumResultsForSearch,
+        'allowClear' => options[:allow_clear]||false,
     }
     js_options['placeholder']= options.has_key?(:placeholder) ? "'#{options[:placeholder]}'" : "''"
     js_options['width']= "'#{width}'" if width
@@ -1063,4 +1059,12 @@ module ApplicationHelper
     end
   end
 
+
+  def get_issue_metrics
+    ['violations',
+     'blocker_violations', 'critical_violations', 'major_violations', 'minor_violations', 'info_violations',
+     'new_blocker_violations', 'new_critical_violations', 'new_major_violations', 'new_minor_violations', 'new_info_violations',
+     'open_issues', 'reopened_issues', 'confirmed_issues', 'false_positive_issues']
+  end
+
 end