From 3641a41af162b73b3ede052b3d4defbda4daa322 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 7 May 2015 14:33:04 +0200 Subject: [PATCH] Corrected with rubocop cop 'Lint/Eval'. --- .rubocop.yml | 2 -- app/models/channel.rb | 2 +- app/models/channel/email_send.rb | 2 +- app/models/scheduler.rb | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 9110496db..a0f8162ce 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -209,7 +209,5 @@ Lint/UnreachableCode: Enabled: false Lint/ShadowingOuterLocalVariable: Enabled: false -Lint/Eval: - Enabled: false Style/ModuleFunction: Enabled: false diff --git a/app/models/channel.rb b/app/models/channel.rb index 820977c55..08b0c1ed4 100644 --- a/app/models/channel.rb +++ b/app/models/channel.rb @@ -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 diff --git a/app/models/channel/email_send.rb b/app/models/channel/email_send.rb index 38acfd626..507a1e4c5 100644 --- a/app/models/channel/email_send.rb +++ b/app/models/channel/email_send.rb @@ -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] diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index d10cd0ec6..cc2ef04ee 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -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 }"