Browse Source

Upgrade to new rubocop.

Martin Edenhofer 9 years ago
parent
commit
ba3f868638

+ 1 - 1
app/controllers/tickets_controller.rb

@@ -354,7 +354,7 @@ class TicketsController < ApplicationController
   def stats
 
     if !params[:user_id] && !params[:organization_id]
-      fail 'Need user_id or organization_id as param'
+      raise 'Need user_id or organization_id as param'
     end
 
     # permission check

+ 1 - 1
app/models/activity_stream.rb

@@ -34,7 +34,7 @@ add a new activity entry for an object
     if data[:role]
       role = Role.lookup(name: data[:role])
       if !role
-        fail "No such Role #{data[:role]}"
+        raise "No such Role #{data[:role]}"
       end
       role_id = role.id
     end

+ 3 - 3
app/models/application_model.rb

@@ -71,7 +71,7 @@ returns
   def self.param_cleanup(params, newObject = false)
 
     if params.nil?
-      fail "No params for #{self}!"
+      raise "No params for #{self}!"
     end
 
     # ignore id for new objects
@@ -377,7 +377,7 @@ returns
       return
     end
 
-    fail 'Need name, id, login or email for lookup()'
+    raise 'Need name, id, login or email for lookup()'
   end
 
 =begin
@@ -535,7 +535,7 @@ returns
       record.save
       return record
     else
-      fail 'Need name, login, email or locale for create_or_update()'
+      raise 'Need name, login, email or locale for create_or_update()'
     end
   end
 

+ 1 - 1
app/models/calendar.rb

@@ -268,7 +268,7 @@ returns
     if location =~ /^http/i
       result = UserAgent.get(location)
       if !result.success?
-        fail result.error
+        raise result.error
       end
       cal_file = result.body
     else

+ 1 - 1
app/models/channel/driver/facebook.rb

@@ -29,7 +29,7 @@ class Channel::Driver::Facebook
       access_token = page['access_token']
     }
     if !access_token
-      fail "No access_token found for fb_object_id: #{fb_object_id}"
+      raise "No access_token found for fb_object_id: #{fb_object_id}"
     end
     client = Facebook.new(access_token)
     client.from_article(article)

+ 2 - 2
app/models/channel/driver/twitter.rb

@@ -184,7 +184,7 @@ returns
 
   def stream
     sync = @channel.options['sync']
-    fail 'Need channel.options[\'sync\'] for account, but no params found' if !sync
+    raise 'Need channel.options[\'sync\'] for account, but no params found' if !sync
 
     filter = {}
     if sync['search']
@@ -315,7 +315,7 @@ returns
   def check_external_credential(options)
     if options[:auth] && options[:auth][:external_credential_id]
       external_credential = ExternalCredential.find_by(id: options[:auth][:external_credential_id])
-      fail "No such ExternalCredential.find(#{options[:auth][:external_credential_id]})" if !external_credential
+      raise "No such ExternalCredential.find(#{options[:auth][:external_credential_id]})" if !external_credential
       options[:auth][:consumer_key] = external_credential.credentials['consumer_key']
       options[:auth][:consumer_secret] = external_credential.credentials['consumer_secret']
     end

+ 2 - 2
app/models/locale.rb

@@ -26,8 +26,8 @@ class Locale < ApplicationModel
       }
     )
 
-    fail "Can't load locales from #{url}" if !result
-    fail "Can't load locales from #{url}: #{result.error}" if !result.success?
+    raise "Can't load locales from #{url}" if !result
+    raise "Can't load locales from #{url}: #{result.error}" if !result.success?
 
     ActiveRecord::Base.transaction do
       result.data.each {|locale|

+ 2 - 2
app/models/observer/ticket/article/communicate_email/background_job.rb

@@ -12,9 +12,9 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
 
     # send email
     if !ticket.group.email_address_id
-      fail "Can't send email, no email address definde for group id '#{ticket.group.id}'"
+      raise "Can't send email, no email address definde for group id '#{ticket.group.id}'"
     elsif !ticket.group.email_address.channel_id
-      fail "Can't send email, no channel definde for email_address id '#{ticket.group.email_address_id}'"
+      raise "Can't send email, no channel definde for email_address id '#{ticket.group.email_address_id}'"
     end
 
     channel = ticket.group.email_address.channel

+ 4 - 4
app/models/observer/ticket/article/communicate_facebook.rb

@@ -20,15 +20,15 @@ class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
     return if type['name'] !~ /\Afacebook/
 
     ticket = Ticket.lookup(id: record.ticket_id)
-    fail "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences
-    fail "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id']
+    raise "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences
+    raise "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id']
     channel = Channel.lookup(id: ticket.preferences['channel_id'])
-    fail "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Afacebook/i
+    raise "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Afacebook/i
 
     # check source object id
     ticket = record.ticket
     if !ticket.preferences['channel_fb_object_id']
-      fail "fb object id is missing in ticket.preferences['channel_fb_object_id'] for Ticket.find(#{ticket.id})"
+      raise "fb object id is missing in ticket.preferences['channel_fb_object_id'] for Ticket.find(#{ticket.id})"
     end
 
     # fill in_reply_to

+ 5 - 5
app/models/observer/ticket/article/communicate_twitter.rb

@@ -18,11 +18,11 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer
     return if type['name'] !~ /\Atwitter/i
 
     ticket = Ticket.lookup(id: record.ticket_id)
-    fail "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences
-    fail "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id']
+    raise "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences
+    raise "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id']
     channel = Channel.lookup(id: ticket.preferences['channel_id'])
-    fail "No such channel id #{ticket.preferences['channel_id']}" if !channel
-    fail "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Atwitter/i
+    raise "No such channel id #{ticket.preferences['channel_id']}" if !channel
+    raise "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Atwitter/i
     tweet = channel.deliver(
       type:        type['name'],
       to:          record.to,
@@ -54,7 +54,7 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer
         record.preferences[:twitter_mention_ids] = twitter_mention_ids
       end
     else
-      fail "Unknown tweet type '#{tweet.class}'"
+      raise "Unknown tweet type '#{tweet.class}'"
     end
 
     record.message_id = tweet.id

Some files were not shown because too many files changed in this diff