Corrected with rubocop cop 'Style/VariableName'.

This commit is contained in:
Thorsten Eckel 2015-05-05 16:14:18 +02:00
parent d63b9d2f9b
commit 50806a4b5e
4 changed files with 26 additions and 28 deletions

View file

@ -256,8 +256,6 @@ Style/ColonMethodCall:
Enabled: false
Rails/Date:
Enabled: false
Style/VariableName:
Enabled: false
Lint/UnreachableCode:
Enabled: false
Lint/ShadowingOuterLocalVariable:

View file

@ -15,7 +15,7 @@ class ImportOtrsController < ApplicationController
end
# connection test
translationMap = {
translation_map = {
'authentication failed' => 'Authentication failed!',
'getaddrinfo: nodename nor servname provided, or not known' => 'Hostname not found!',
'No route to host' => 'No route to host!',
@ -26,7 +26,7 @@ class ImportOtrsController < ApplicationController
response = UserAgent.request(params[:url])
if !response.success? && response.code.to_s !~ /^40.$/
message_human = ''
translationMap.each {|key, message|
translation_map.each {|key, message|
if response.error.to_s =~ /#{Regexp.escape(key)}/i
message_human = message
end

View file

@ -18,8 +18,8 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
EventBuffer.reset
# get uniq objects
listObjects = get_uniq_changes(list)
listObjects.each {|ticket_id, item|
list_objects = get_uniq_changes(list)
list_objects.each {|ticket_id, item|
# send background job
Delayed::Job.enqueue( Observer::Ticket::Notification::BackgroundJob.new( item ) )
@ -49,7 +49,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
=end
def self.get_uniq_changes(events)
listObjects = {}
list_objects = {}
events.each { |event|
# get current state of objects
@ -60,14 +60,14 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
next if !article
ticket = article.ticket
if !listObjects[ticket.id]
listObjects[ticket.id] = {}
if !list_objects[ticket.id]
list_objects[ticket.id] = {}
end
listObjects[ticket.id][:article_id] = article.id
listObjects[ticket.id][:ticket_id] = ticket.id
list_objects[ticket.id][:article_id] = article.id
list_objects[ticket.id][:ticket_id] = ticket.id
if !listObjects[ticket.id][:type]
listObjects[ticket.id][:type] = 'update'
if !list_objects[ticket.id][:type]
list_objects[ticket.id][:type] = 'update'
end
elsif event[:name] == 'Ticket'
@ -76,25 +76,25 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
# next if ticket is already deleted
next if !ticket
if !listObjects[ticket.id]
listObjects[ticket.id] = {}
if !list_objects[ticket.id]
list_objects[ticket.id] = {}
end
listObjects[ticket.id][:ticket_id] = ticket.id
list_objects[ticket.id][:ticket_id] = ticket.id
if !listObjects[ticket.id][:type] || listObjects[ticket.id][:type] == 'update'
listObjects[ticket.id][:type] = event[:type]
if !list_objects[ticket.id][:type] || list_objects[ticket.id][:type] == 'update'
list_objects[ticket.id][:type] = event[:type]
end
# merge changes
if event[:changes]
if !listObjects[ticket.id][:changes]
listObjects[ticket.id][:changes] = event[:changes]
if !list_objects[ticket.id][:changes]
list_objects[ticket.id][:changes] = event[:changes]
else
event[:changes].each {|key, value|
if !listObjects[ticket.id][:changes][key]
listObjects[ticket.id][:changes][key] = value
if !list_objects[ticket.id][:changes][key]
list_objects[ticket.id][:changes][key] = value
else
listObjects[ticket.id][:changes][key][1] = value[1]
list_objects[ticket.id][:changes][key][1] = value[1]
end
}
end
@ -103,7 +103,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
raise "unknown object for notification #{event[:name]}"
end
}
listObjects
list_objects
end
def after_create(record)

View file

@ -260,10 +260,10 @@ returns
file.flock( File::LOCK_EX )
all = file.read
file.flock( File::LOCK_UN )
dataJSON = JSON.parse( all )
if dataJSON
data = self.symbolize_keys(dataJSON)
data[:user] = dataJSON['user'] # for compat. reasons
data_json = JSON.parse( all )
if data_json
data = self.symbolize_keys(data_json)
data[:user] = data_json['user'] # for compat. reasons
end
}
rescue Exception => e