diff options
author | Simon Brandhof <SimonBrandhof@imac2-sonarsource.local> | 2011-01-11 11:45:03 +0100 |
---|---|---|
committer | Simon Brandhof <SimonBrandhof@imac2-sonarsource.local> | 2011-01-11 11:45:03 +0100 |
commit | 2bb6d6aacb53cd667339e2cfacf115967cbd519c (patch) | |
tree | f1ed3193971f3f58a1e631deb1a338e3663bf4b0 /sonar-server | |
parent | b17e7e2321a4c53ed443ba4ba82ccaa3bec914e0 (diff) | |
download | sonarqube-2bb6d6aacb53cd667339e2cfacf115967cbd519c.tar.gz sonarqube-2bb6d6aacb53cd667339e2cfacf115967cbd519c.zip |
SONAR-2067 Upgrade to JRuby 1.5.6
Diffstat (limited to 'sonar-server')
12 files changed, 15 insertions, 15 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rest_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rest_controller.rb index ba77ef9b774..c073a69d793 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rest_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rest_controller.rb @@ -59,7 +59,7 @@ class Api::RestController < ApplicationController end def check_database_version - if not DatabaseVersion.uptodate? + if !(DatabaseVersion.uptodate?) rest_status_ko("Database version not up to date", 500) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/backup_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/backup_controller.rb index 582457a867c..93a3a94adac 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/backup_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/backup_controller.rb @@ -37,7 +37,7 @@ class BackupController < ApplicationController def import file=params[:file] xml=read_file(file) - if xml and not xml.empty? + if xml && !xml.empty? java_facade.getBackup().importXml(xml) Metric.clear_cache flash[:notice] = "Backup restore succeed" diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/alert.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/alert.rb index d22afd90dd0..8f5109e02c1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/alert.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/alert.rb @@ -43,9 +43,9 @@ class Alert < ActiveRecord::Base protected def validate - errors.add('Can not set alerts on data metrics.') if metric and metric.val_type==Metric::VALUE_TYPE_DATA + errors.add('Can not set alerts on data metrics.') if metric && metric.val_type==Metric::VALUE_TYPE_DATA errors.add_to_base('Can not set alerts on alerts.') if metric==Metric.by_key(Metric::ALERT_STATUS) - errors.add_to_base('At least one threshold (warning or error) is required.') if value_error.blank? and value_warning.blank? + errors.add_to_base('At least one threshold (warning or error) is required.') if value_error.blank? && value_warning.blank? end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/event_category.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/event_category.rb index be4632b2898..45752172e1c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/event_category.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/event_category.rb @@ -80,7 +80,7 @@ class EventCategory end def editable? - not [KEY_VERSION, KEY_ALERT].include? name + !([KEY_VERSION, KEY_ALERT].include?(name)) end def self.defaults diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb index d4762df86ad..87b1ac4507e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb @@ -51,7 +51,7 @@ class Project < ActiveRecord::Base end def events_with_snapshot - events.select{|event| not event.snapshot_id.nil?} + events.select{|event| !event.snapshot_id.nil?} end def key diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb index e1877fa6e9d..03caa8495f5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -287,7 +287,7 @@ class ProjectMeasure < ActiveRecord::Base end def validate_date - if not measure_date + if measure_date.nil? errors.add_to_base('A valid date must be provided') else last_snasphot_date = project.last_snapshot.created_at @@ -311,7 +311,7 @@ class ProjectMeasure < ActiveRecord::Base raw_value = send("value_before_type_cast") if raw_value.instance_of?(String) raw_value = raw_value.downcase - errors.add_to_base("Value must be 'No' or 'Yes'") if raw_value != "yes" and raw_value != "no" + errors.add_to_base("Value must be 'No' or 'Yes'") if raw_value != "yes" && raw_value != "no" write_attribute( "value", 1.0) if raw_value == "yes" write_attribute( "value", 0.0) if raw_value == "no" end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb index 05b12fcda0a..c94e7887b39 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb @@ -102,7 +102,7 @@ class Rule < ActiveRecord::Base else json['priority'] = priority_text end - json['params'] = parameters.collect{|parameter| parameter.to_hash_json(active_rule)} if not parameters.empty? + json['params'] = parameters.collect{|parameter| parameter.to_hash_json(active_rule)} unless parameters.empty? json end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb index 18fbec5b5f3..98f341ad805 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb @@ -33,7 +33,7 @@ class RulesParameter < ActiveRecord::Base belongs_to :rule def is_set_type - return param_type.at(1) == "[" and param_type.ends_with?( "]" ) + return param_type.at(1) == "[" && param_type.ends_with?( "]" ) end def get_allowed_tokens @@ -88,7 +88,7 @@ class RulesParameter < ActiveRecord::Base end end elsif param_type == RulesParameter::PARAM_TYPE_BOOLEAN - if attribute != "true" and attribute != "false" + if attribute != "true" && attribute != "false" errors.add( "#{value}", "Invalid value '" + attribute + "'. Must be one of : true,false" ) end elsif param_type == RulesParameter::PARAM_TYPE_REGEXP diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb index 7024cd9fbfd..408f32b9e26 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb @@ -165,7 +165,7 @@ class Snapshot < ActiveRecord::Base end def self.snapshot_by_date(resource_id, date) - if resource_id and date + if resource_id && date Snapshot.find(:first, :conditions => ['created_at>=? and created_at<? and project_id=?', date.beginning_of_day, date.end_of_day, resource_id], :order => 'created_at desc') else nil diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb index 03c34f9d0d4..93145461a19 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb @@ -162,7 +162,7 @@ class Sonar::ComponentsConfiguration columns.sort! { |x, y| x.name = "" if x.name.nil? y.name = "" if y.name.nil? - x.name <=> y.name if x.name and y.name + x.name <=> y.name if x.name && y.name } } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/timemachine_row.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/timemachine_row.rb index dbeb484cf2b..91973a19e30 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/timemachine_row.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/timemachine_row.rb @@ -42,7 +42,7 @@ class Sonar::TimemachineRow end def sparkline_url - if metric.numeric? and @measure_by_sid.size>1 + if metric.numeric? && @measure_by_sid.size>1 values=[] @measure_by_sid.values.each do |measure| # date.to_f does not works under oracle diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/timemachine/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/timemachine/index.html.erb index 0d932fe77a2..752a50ae471 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/timemachine/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/timemachine/index.html.erb @@ -165,7 +165,7 @@ values=[] colors=[] @snapshots.each_with_index do |snapshot, index| - if row.measure(snapshot) and row.measure(snapshot).data + if row.measure(snapshot) && row.measure(snapshot).data values<<u(row.measure(snapshot).data) else values<<'' |