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 =~ /^ROC/
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
}

View file

@ -76,7 +76,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
# validate url
messages = {}
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'
end
end

View file

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

View file

@ -108,7 +108,7 @@ returns
# set relations
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 )
list_of_items = params[ real_key.to_sym ]
if params[ real_key.to_sym ].class != Array
@ -141,7 +141,7 @@ returns
# set relations
attributes = self.attributes
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 )
attributes[ real_key ] = self.send( real_key )
end
@ -873,7 +873,7 @@ log object update history with all updated attributes, if configured - will be e
# get attribute name
attribute_name = key.to_s
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
value_id = []

View file

@ -113,7 +113,7 @@ returns
attribute_name_with_id = key.to_s
attribute_name = key.to_s
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
next if !ref_object.respond_to?( attribute_name )

View file

@ -535,9 +535,9 @@ class Channel::EmailParser
next if key == 'created_by_id'
# check if id exists
key_short = key[ key.length-3 , key.length ]
key_short = key[ key.length - 3 , key.length ]
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}"
if 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',
o_id: ticket.id,
seen: seen,
created_by_id: ticket.updated_by_id || 1,
created_by_id: ticket.updated_by_id ||  1,
user_id: user.id,
)
@ -134,7 +134,7 @@ class Observer::Ticket::Notification::BackgroundJob
history_type: 'notification',
history_object: 'Ticket',
value_to: recipient_list,
created_by_id: ticket.updated_by_id || 1
created_by_id: ticket.updated_by_id ||  1
)
end
end
@ -166,7 +166,7 @@ class Observer::Ticket::Notification::BackgroundJob
attribute_name = key.to_s
object_manager_attribute = attribute_list[attribute_name]
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
# add item to changes hash

View file

@ -22,7 +22,7 @@ returns
# get attribute name
attribute_name = key.to_s
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
next if !ref_object.respond_to?( attribute_name )

View file

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

View file

@ -14,7 +14,7 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
condition: {
'tickets.state_id' => [3],
'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: {
by: 'created_at',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -43,7 +43,7 @@ class Sessions::Backend::Rss
data = self.load
return if !data||data.empty?
return if !data || data.empty?
if !@client
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
if next_hour == 23
start_time += diff-1
start_time += diff - 1
else
start_time += diff
end
@ -334,7 +334,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
# keep it in current day
if next_hour == 23
start_time += diff-1
start_time += diff - 1
else
start_time += diff
end

View file

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

View file

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

View file

@ -28,7 +28,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -49,9 +49,9 @@ class TicketSlaTest < ActiveSupport::TestCase
sla = Sla.create(
name: 'test sla 2',
condition: { 'tickets.priority_id' =>['1', '2', '3'] },
condition: { 'tickets.priority_id' => ['1', '2', '3'] },
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',
'end_of_workday' => '18:00',
},
@ -360,7 +360,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -402,7 +402,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -445,7 +445,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -549,7 +549,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -612,7 +612,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -706,7 +706,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -816,7 +816,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},