]> source.dussan.org Git - sonarqube.git/commitdiff
Fix compatibility with Ruby 1.9
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 4 Apr 2012 10:29:12 +0000 (12:29 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 4 Apr 2012 10:29:12 +0000 (12:29 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb

index 9e8741431e2b7a83ee432e1dc697908f809b7004..08795e95357f9f4ad8c3292b67e670741e2017d1 100644 (file)
@@ -353,10 +353,10 @@ class ProfilesController < ApplicationController
       @sames=[]
       diffs_by_rule.values.sort.each do |diff|
         case diff.status
-        when DIFF_IN1: @in1<<diff
-        when DIFF_IN2: @in2<<diff
-        when DIFF_MODIFIED: @modified<<diff
-        when DIFF_SAME: @sames<<diff
+        when DIFF_IN1 then @in1<<diff
+        when DIFF_IN2 then @in2<<diff
+        when DIFF_MODIFIED then @modified<<diff
+        when DIFF_SAME then @sames<<diff
         end
       end
     end
index 0e805200f4359943c3edd36d69c9d2d73957518f..f714d49b9109d156d2f142ee6cefc91d63dd2a58 100644 (file)
@@ -48,12 +48,12 @@ module RolesHelper
 
   def role_name(role)
     case(role.to_s)
-      when 'admin': 'Administrators'
-      when 'default-admin': 'Administrators'
-      when 'user': 'Users'
-      when 'default-user': 'Users'
-      when 'codeviewer': 'Code viewers'
-      when 'default-codeviewer': 'Code viewers'
+      when 'admin' then 'Administrators'
+      when 'default-admin' then 'Administrators'
+      when 'user' then 'Users'
+      when 'default-user' then 'Users'
+      when 'codeviewer' then 'Code viewers'
+      when 'default-codeviewer' then 'Code viewers'
       else role.to_s
     end
   end
index 52e137b9ff40abf0ee767258be3d86e0b2136942..9c7a21086a390e50d3e3a66f0c828c4b2e4d1094 100644 (file)
@@ -46,15 +46,15 @@ class MeasureColor
     else
       if (options[:check_alert_status]||true) && !measure.alert_status.blank?
         case(measure.alert_status)
-          when Metric::TYPE_LEVEL_OK : percent=100.0
-          when Metric::TYPE_LEVEL_ERROR : percent=0.0
-          when Metric::TYPE_LEVEL_WARN : percent=50.0
+          when Metric::TYPE_LEVEL_OK then percent=100.0
+          when Metric::TYPE_LEVEL_ERROR then percent=0.0
+          when Metric::TYPE_LEVEL_WARN then percent=50.0
         end
       elsif measure.metric.value_type==Metric::VALUE_TYPE_LEVEL
         case(measure.text_value)
-          when Metric::TYPE_LEVEL_OK : percent=100.0
-          when Metric::TYPE_LEVEL_WARN : percent=50.0
-          when Metric::TYPE_LEVEL_ERROR : percent=0.0
+          when Metric::TYPE_LEVEL_OK then percent=100.0
+          when Metric::TYPE_LEVEL_WARN then percent=50.0
+          when Metric::TYPE_LEVEL_ERROR then percent=0.0
         end
       elsif measure.value && max_value && min_value
         percent = value_to_percent(measure.value, min_value, max_value)