Corrected with rubocop cop 'Lint/NonLocalExitFromIterator'.

This commit is contained in:
Thorsten Eckel 2015-05-05 16:36:05 +02:00
parent b08a817e3d
commit ba2d2e8296
6 changed files with 16 additions and 11 deletions

View file

@ -250,8 +250,6 @@ Style/SpaceBeforeComment:
Enabled: false Enabled: false
Lint/UselessAssignment: Lint/UselessAssignment:
Enabled: false Enabled: false
Lint/NonLocalExitFromIterator:
Enabled: false
Rails/Date: Rails/Date:
Enabled: false Enabled: false
Lint/UnreachableCode: Lint/UnreachableCode:

View file

@ -239,21 +239,21 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
result = email_probe_inbound( settings[:inbound] ) result = email_probe_inbound( settings[:inbound] )
if result[:result] != 'ok' if result[:result] != 'ok'
render json: result render json: result
return return # rubocop:disable Lint/NonLocalExitFromIterator
end end
# probe outbound # probe outbound
result = email_probe_outbound( settings[:outbound], params[:email] ) result = email_probe_outbound( settings[:outbound], params[:email] )
if result[:result] != 'ok' if result[:result] != 'ok'
render json: result render json: result
return return # rubocop:disable Lint/NonLocalExitFromIterator
end end
render json: { render json: {
result: 'ok', result: 'ok',
setting: settings, setting: settings,
} }
return return # rubocop:disable Lint/NonLocalExitFromIterator
end end
} }
} }
@ -632,7 +632,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
message: e.to_s, message: e.to_s,
subject: subject, subject: subject,
} }
return return # rubocop:disable Lint/NonLocalExitFromIterator
end end
if found && found == 'verify ok' if found && found == 'verify ok'
@ -693,7 +693,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
render json: { render json: {
result: 'ok', result: 'ok',
} }
return return # rubocop:disable Lint/NonLocalExitFromIterator
end end
} }

View file

@ -56,7 +56,7 @@ class ImportOtrsController < ApplicationController
url: url, url: url,
result: 'ok', result: 'ok',
} }
return return # rubocop:disable Lint/NonLocalExitFromIterator
elsif response.body =~ /(otrs\sag|otrs.com|otrs.org)/i elsif response.body =~ /(otrs\sag|otrs.com|otrs.org)/i
message_human = 'Host found, but no OTRS migrator is installed!' message_human = 'Host found, but no OTRS migrator is installed!'
end end

View file

@ -41,7 +41,7 @@ returns
# load backend # load backend
backend = self.load_adapter( config_item[:adapter] ) backend = self.load_adapter( config_item[:adapter] )
return if !backend next if !backend
user_auth = backend.check( username, password, config_item, user ) user_auth = backend.check( username, password, config_item, user )

View file

@ -32,9 +32,16 @@ class Sessions::Backend::Collections::Base
return if !access return if !access
end end
if self.class.is_not_role if self.class.is_not_role
is_role = false
self.class.is_not_role.each {|role| self.class.is_not_role.each {|role|
return if @user.is_role(role)
next if !@user.is_role(role)
is_role = true
break
} }
return if is_role
end end
# check timeout # check timeout

View file

@ -52,7 +52,7 @@ returns
# load backend # load backend
backend = self.load_adapter( config_item[:adapter] ) backend = self.load_adapter( config_item[:adapter] )
return if !backend next if !backend
user_auth = backend.check( params, config_item ) user_auth = backend.check( params, config_item )