Applied rubocop Style/SpaceAroundOperators.

This commit is contained in:
Martin Edenhofer 2015-04-27 16:41:03 +02:00
parent ca0d651262
commit c34a33da99
22 changed files with 51 additions and 51 deletions

View file

@ -267,7 +267,7 @@ class ApplicationController < ActionController::Base
next if t.name =~ /^MST/ next if t.name =~ /^MST/
next if t.name =~ /^ROC/ next if t.name =~ /^ROC/
next if t.name =~ /^ROK/ next if t.name =~ /^ROK/
diff = t.current_period.utc_total_offset / 60 /60 diff = t.current_period.utc_total_offset / 60 / 60
config['timezones'][ t.name ] = diff config['timezones'][ t.name ] = diff
} }

View file

@ -76,7 +76,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
# validate url # validate url
messages = {} messages = {}
if !Setting.get('system_online_service') if !Setting.get('system_online_service')
if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/ if !params[:url] || params[:url] !~ /^(http|https):\/\/.+?$/
messages[:url] = 'A URL looks like http://zammad.example.com' messages[:url] = 'A URL looks like http://zammad.example.com'
end end
end end

View file

@ -6,7 +6,7 @@ class ImportOtrsController < ApplicationController
return if setup_done_response return if setup_done_response
# validate # validate
if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/ if !params[:url] || params[:url] !~ /^(http|https):\/\/.+?$/
render json: { render json: {
result: 'invalid', result: 'invalid',
message: 'Invalid!', message: 'Invalid!',

View file

@ -108,7 +108,7 @@ returns
# set relations # set relations
self.class.reflect_on_all_associations.map { |assoc| self.class.reflect_on_all_associations.map { |assoc|
real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids' real_key = assoc.name.to_s[0,assoc.name.to_s.length - 1] + '_ids'
if params.has_key?( real_key.to_sym ) if params.has_key?( real_key.to_sym )
list_of_items = params[ real_key.to_sym ] list_of_items = params[ real_key.to_sym ]
if params[ real_key.to_sym ].class != Array if params[ real_key.to_sym ].class != Array
@ -141,7 +141,7 @@ returns
# set relations # set relations
attributes = self.attributes attributes = self.attributes
self.class.reflect_on_all_associations.map { |assoc| self.class.reflect_on_all_associations.map { |assoc|
real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids' real_key = assoc.name.to_s[0,assoc.name.to_s.length - 1] + '_ids'
if self.respond_to?( real_key ) if self.respond_to?( real_key )
attributes[ real_key ] = self.send( real_key ) attributes[ real_key ] = self.send( real_key )
end end
@ -873,7 +873,7 @@ log object update history with all updated attributes, if configured - will be e
# get attribute name # get attribute name
attribute_name = key.to_s attribute_name = key.to_s
if attribute_name[-3,3] == '_id' if attribute_name[-3,3] == '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ] attribute_name = attribute_name[ 0, attribute_name.length - 3 ]
end end
value_id = [] value_id = []

View file

@ -113,7 +113,7 @@ returns
attribute_name_with_id = key.to_s attribute_name_with_id = key.to_s
attribute_name = key.to_s attribute_name = key.to_s
next if attribute_name[-3,3] != '_id' next if attribute_name[-3,3] != '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ] attribute_name = attribute_name[ 0, attribute_name.length - 3 ]
# check if attribute method exists # check if attribute method exists
next if !ref_object.respond_to?( attribute_name ) next if !ref_object.respond_to?( attribute_name )

View file

@ -535,9 +535,9 @@ class Channel::EmailParser
next if key == 'created_by_id' next if key == 'created_by_id'
# check if id exists # check if id exists
key_short = key[ key.length-3 , key.length ] key_short = key[ key.length - 3 , key.length ]
if key_short == '_id' if key_short == '_id'
key_short = key[ 0, key.length-3 ] key_short = key[ 0, key.length - 3 ]
header = "x-zammad-#{header_name}-#{key_short}" header = "x-zammad-#{header_name}-#{key_short}"
if mail[ header.to_sym ] if mail[ header.to_sym ]
puts "NOTICE: header #{header} found #{mail[ header.to_sym ]}" puts "NOTICE: header #{header} found #{mail[ header.to_sym ]}"

View file

@ -70,7 +70,7 @@ class Observer::Ticket::Notification::BackgroundJob
object: 'Ticket', object: 'Ticket',
o_id: ticket.id, o_id: ticket.id,
seen: seen, seen: seen,
created_by_id: ticket.updated_by_id || 1, created_by_id: ticket.updated_by_id ||  1,
user_id: user.id, user_id: user.id,
) )
@ -134,7 +134,7 @@ class Observer::Ticket::Notification::BackgroundJob
history_type: 'notification', history_type: 'notification',
history_object: 'Ticket', history_object: 'Ticket',
value_to: recipient_list, value_to: recipient_list,
created_by_id: ticket.updated_by_id || 1 created_by_id: ticket.updated_by_id ||  1
) )
end end
end end
@ -166,7 +166,7 @@ class Observer::Ticket::Notification::BackgroundJob
attribute_name = key.to_s attribute_name = key.to_s
object_manager_attribute = attribute_list[attribute_name] object_manager_attribute = attribute_list[attribute_name]
if attribute_name[-3,3] == '_id' if attribute_name[-3,3] == '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ].to_s attribute_name = attribute_name[ 0, attribute_name.length - 3 ].to_s
end end
# add item to changes hash # add item to changes hash

View file

@ -22,7 +22,7 @@ returns
# get attribute name # get attribute name
attribute_name = key.to_s attribute_name = key.to_s
next if attribute_name[-3,3] != '_id' next if attribute_name[-3,3] != '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ] attribute_name = attribute_name[ 0, attribute_name.length - 3 ]
# check if attribute method exists # check if attribute method exists
next if !ref_object.respond_to?( attribute_name ) next if !ref_object.respond_to?( attribute_name )

View file

@ -391,7 +391,7 @@ class Package < ApplicationModel
# check if directories need to be created # check if directories need to be created
directories = location.split '/' directories = location.split '/'
(0..(directories.length-2) ).each {|position| (0..(directories.length - 2) ).each {|position|
tmp_path = '' tmp_path = ''
(1..position).each {|count| (1..position).each {|count|
tmp_path = tmp_path + '/' + directories[count].to_s tmp_path = tmp_path + '/' + directories[count].to_s

View file

@ -14,7 +14,7 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
condition: { condition: {
'tickets.state_id' => [3], 'tickets.state_id' => [3],
'tickets.owner_id' => 'current_user.id', 'tickets.owner_id' => 'current_user.id',
'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' }, 'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
}, },
order: { order: {
by: 'created_at', by: 'created_at',

View file

@ -1429,7 +1429,7 @@ Overview.create_if_not_exists(
condition: { condition: {
'tickets.state_id' => [3], 'tickets.state_id' => [3],
'tickets.owner_id' => 'current_user.id', 'tickets.owner_id' => 'current_user.id',
'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' }, 'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
}, },
order: { order: {
by: 'created_at', by: 'created_at',
@ -1491,7 +1491,7 @@ Overview.create_if_not_exists(
role_id: overview_role.id, role_id: overview_role.id,
condition: { condition: {
'tickets.state_id' => [3], 'tickets.state_id' => [3],
'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' }, 'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
}, },
order: { order: {
by: 'created_at', by: 'created_at',
@ -1511,7 +1511,7 @@ Overview.create_if_not_exists(
prio: 1040, prio: 1040,
role_id: overview_role.id, role_id: overview_role.id,
condition: { condition: {
'tickets.escalation_time' => { 'direction' => 'before', 'count'=> 5, 'area' => 'minute' }, 'tickets.escalation_time' => { 'direction' => 'before', 'count' => 5, 'area' => 'minute' },
}, },
order: { order: {
by: 'escalation_time', by: 'escalation_time',

View file

@ -54,7 +54,7 @@ module FillDB
suffix = rand(99_999).to_s suffix = rand(99_999).to_s
organization = nil organization = nil
if !organization_pool.empty? && rand(2) == 1 if !organization_pool.empty? && rand(2) == 1
organization = organization_pool[ organization_pool.length-1 ] organization = organization_pool[ organization_pool.length - 1 ]
end end
user = User.create_or_update( user = User.create_or_update(
login: "filldb-customer-#{suffix}", login: "filldb-customer-#{suffix}",
@ -95,15 +95,15 @@ module FillDB
state_pool = Ticket::State.all state_pool = Ticket::State.all
if tickets && !tickets.zero? if tickets && !tickets.zero?
(1..tickets).each {|count| (1..tickets).each {|count|
customer = customer_pool[ rand(customer_pool.length-1) ] customer = customer_pool[ rand(customer_pool.length - 1) ]
agent = agent_pool[ rand(agent_pool.length-1) ] agent = agent_pool[ rand(agent_pool.length - 1) ]
ticket = Ticket.create( ticket = Ticket.create(
title: 'some title äöüß' + rand(999_999).to_s, title: 'some title äöüß' + rand(999_999).to_s,
group: group_pool[ rand(group_pool.length-1) ], group: group_pool[ rand(group_pool.length - 1) ],
customer: customer, customer: customer,
owner: agent, owner: agent,
state: state_pool[ rand(state_pool.length-1) ], state: state_pool[ rand(state_pool.length - 1) ],
priority: priority_pool[ rand(priority_pool.length-1) ], priority: priority_pool[ rand(priority_pool.length - 1) ],
updated_by_id: agent.id, updated_by_id: agent.id,
created_by_id: agent.id, created_by_id: agent.id,
) )

View file

@ -347,7 +347,7 @@ module Import::OTRS2
run = true run = true
while run while run
count += steps count += steps
records = load('CustomerUser', steps, count-steps) records = load('CustomerUser', steps, count - steps)
if !records || !records[0] if !records || !records[0]
log 'all customers imported.' log 'all customers imported.'
run = false run = false
@ -371,11 +371,11 @@ module Import::OTRS2
while run while run
count += steps count += steps
log "loading... thread# #{thread} ..." log "loading... thread# #{thread} ..."
offset = count-steps offset = count - steps
if offset != 0 if offset != 0
offset = count - steps + 1 offset = count - steps + 1
end end
records = load( 'Ticket', steps, count-steps) records = load( 'Ticket', steps, count - steps)
if !records || !records[0] if !records || !records[0]
log "... thread# #{thread}, no more work." log "... thread# #{thread}, no more work."
run = false run = false
@ -450,11 +450,11 @@ module Import::OTRS2
while run while run
count += steps count += steps
log 'loading... diff ...' log 'loading... diff ...'
offset = count-steps offset = count - steps
if offset != 0 if offset != 0
offset = count - steps + 1 offset = count - steps + 1
end end
records = load( 'Ticket', steps, count-steps, 1 ) records = load( 'Ticket', steps, count - steps, 1 )
if !records || !records[0] if !records || !records[0]
log '... no more work.' log '... no more work.'
run = false run = false
@ -1037,7 +1037,7 @@ module Import::OTRS2
if group_lookup['Name'] == 'admin' && permissions && permissions.include?('rw') if group_lookup['Name'] == 'admin' && permissions && permissions.include?('rw')
roles.push 'Admin' roles.push 'Admin'
end end
if group_lookup['Name'] =~ /^(stats|report)/ && permissions && ( permissions.include?('ro') || permissions.include?('rw') ) if group_lookup['Name'] =~ /^(stats|report)/ && permissions && ( permissions.include?('ro') ||  permissions.include?('rw') )
roles.push 'Report' roles.push 'Report'
end end
end end

View file

@ -43,7 +43,7 @@ class Sessions::Backend::ActivityStream
data = self.load data = self.load
return if !data||data.empty? return if !data || data.empty?
if !@client if !@client
return { return {

View file

@ -52,7 +52,7 @@ class Sessions::Backend::Collections::Base
# load current data # load current data
items = self.load items = self.load
return if !items||items.empty? return if !items || items.empty?
# get relations of data # get relations of data
all = [] all = []

View file

@ -43,7 +43,7 @@ class Sessions::Backend::Rss
data = self.load data = self.load
return if !data||data.empty? return if !data || data.empty?
if !@client if !@client
return { return {

View file

@ -197,7 +197,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
# keep it in current day # keep it in current day
if next_hour == 23 if next_hour == 23
start_time += diff-1 start_time += diff - 1
else else
start_time += diff start_time += diff
end end
@ -334,7 +334,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
# keep it in current day # keep it in current day
if next_hour == 23 if next_hour == 23
start_time += diff-1 start_time += diff - 1
else else
start_time += diff start_time += diff
end end

View file

@ -22,7 +22,7 @@ def checkForHeader(fileName)
# detect file type # detect file type
if allLines[0] =~ /(^# Copyright)/ || allLines[1] =~ /(^# Copyright)/ if allLines[0] =~ /(^# Copyright)/ || allLines[1] =~ /(^# Copyright)/
foundHeader = true foundHeader = true
elsif allLines[1] =~/^=begin/ #assume external script elsif allLines[1] =~ /^=begin/ #assume external script
foundHeader = true foundHeader = true
end end
if allLines[0] =~ /(^#!\/)/ if allLines[0] =~ /(^#!\/)/

View file

@ -64,7 +64,7 @@ puts "Starting websocket server on #{ @options[:b] }:#{ @options[:p] } (secure:#
if ARGV[0] == 'stop' if ARGV[0] == 'stop'
# read pid # read pid
pid =File.open( @options[:i].to_s ).read pid = File.open( @options[:i].to_s ).read
pid.gsub!(/\r|\n/, '') pid.gsub!(/\r|\n/, '')
# kill # kill

View file

@ -28,7 +28,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '8:00', 'beginning_of_workday' => '8:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -49,9 +49,9 @@ class TicketSlaTest < ActiveSupport::TestCase
sla = Sla.create( sla = Sla.create(
name: 'test sla 2', name: 'test sla 2',
condition: { 'tickets.priority_id' =>['1', '2', '3'] }, condition: { 'tickets.priority_id' => ['1', '2', '3'] },
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '8:00', 'beginning_of_workday' => '8:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -360,7 +360,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '9:00', 'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -402,7 +402,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '9:00', 'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -445,7 +445,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '9:00', 'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -549,7 +549,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '9:00', 'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -612,7 +612,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '9:00', 'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -706,7 +706,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '9:00', 'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },
@ -816,7 +816,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1', name: 'test sla 1',
condition: {}, condition: {},
data: { data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '9:00', 'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00', 'end_of_workday' => '18:00',
}, },