Corrected with rubocop cop 'Lint/Eval'.

This commit is contained in:
Thorsten Eckel 2015-05-07 14:33:04 +02:00
parent 67c4215554
commit 3641a41af1
4 changed files with 3 additions and 5 deletions

View file

@ -209,7 +209,5 @@ Lint/UnreachableCode:
Enabled: false
Lint/ShadowingOuterLocalVariable:
Enabled: false
Lint/Eval:
Enabled: false
Style/ModuleFunction:
Enabled: false

View file

@ -7,7 +7,7 @@ class Channel < ApplicationModel
channels = Channel.where( 'active = ? AND area LIKE ?', true, '%::Inbound' )
channels.each { |channel|
begin
c = eval 'Channel::' + channel[:adapter].upcase + '.new'
c = eval 'Channel::' + channel[:adapter].upcase + '.new' # rubocop:disable Lint/Eval
c.fetch(channel)
rescue Exception => e
logger.error "can't use " + 'Channel::' + channel[:adapter].upcase

View file

@ -6,7 +6,7 @@ module Channel::EmailSend
def self.send(attr, notification = false)
channel = Channel.find_by( area: 'Email::Outbound', active: true )
begin
c = eval 'Channel::' + channel[:adapter] + '.new'
c = eval 'Channel::' + channel[:adapter] + '.new' # rubocop:disable Lint/Eval
c.send(attr, channel, notification)
rescue Exception => e
Rails.logger.error "can't use " + 'Channel::' + channel[:adapter]

View file

@ -68,7 +68,7 @@ class Scheduler < ApplicationModel
job.pid = Thread.current.object_id
job.save
logger.info "execute #{job.method} (runner #{runner} of #{runner_count}, try_count #{try_count})..."
eval job.method()
eval job.method() # rubocop:disable Lint/Eval
rescue => e
logger.error "execute #{job.method} (runner #{runner} of #{runner_count}, try_count #{try_count}) exited with error #{ e.inspect }"