Applied rubocop Style/SpaceAfterComma.

This commit is contained in:
Martin Edenhofer 2015-04-27 16:53:29 +02:00
parent 081d71ffa3
commit 16ddef38e9
34 changed files with 78 additions and 78 deletions

View file

@ -105,7 +105,7 @@ curl http://localhost/api/v1/online_notifications/mark_all_as_read -v -u #{login
=end
def mark_all_as_read
notifications = OnlineNotification.list(current_user,100)
notifications = OnlineNotification.list(current_user, 100)
notifications.each do |notification|
if !notification['seen']
OnlineNotification.seen( id: notification['id'] )

View file

@ -18,7 +18,7 @@ class TaskbarController < ApplicationController
end
def create
model_create_render(Taskbar,params)
model_create_render(Taskbar, params)
end
def update

View file

@ -89,7 +89,7 @@ return all activity entries of an user
=end
def self.list(user,limit)
def self.list(user, limit)
role_ids = user.role_ids
group_ids = user.group_ids

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
@ -872,13 +872,13 @@ 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'
if attribute_name[-3, 3] == '_id'
attribute_name = attribute_name[ 0, attribute_name.length - 3 ]
end
value_id = []
value_str = [ value[0], value[1] ]
if key.to_s[-3,3] == '_id'
if key.to_s[-3, 3] == '_id'
value_id[0] = value[0]
value_id[1] = value[1]

View file

@ -112,7 +112,7 @@ returns
# get attribute name
attribute_name_with_id = 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 ]
# check if attribute method exists

View file

@ -526,7 +526,7 @@ class Channel::EmailParser
def set_attributes_by_x_headers( item_object, header_name, mail )
# loop all x-zammad-hedaer-* headers
item_object.attributes.each{|key,value|
item_object.attributes.each{|key, value|
# ignore read only attributes
next if key == 'updated_at'

View file

@ -65,7 +65,7 @@ class Channel::IMAP < Channel::EmailParser
# check for verify message
if check_type == 'verify'
subject = @imap.fetch(message_id,'ENVELOPE')[0].attr['ENVELOPE'].subject
subject = @imap.fetch(message_id, 'ENVELOPE')[0].attr['ENVELOPE'].subject
if subject && subject =~ /#{verify_string}/
puts " - verify email #{verify_string} found"
@imap.store(message_id, '+FLAGS', [:Deleted])
@ -76,7 +76,7 @@ class Channel::IMAP < Channel::EmailParser
else
# delete email from server after article was created
msg = @imap.fetch(message_id,'RFC822')[0].attr['RFC822']
msg = @imap.fetch(message_id, 'RFC822')[0].attr['RFC822']
if process(channel, msg)
@imap.store(message_id, '+FLAGS', [:Deleted])
end

View file

@ -227,7 +227,7 @@ class Channel::TWITTER2
ticket = Ticket.create(
group_id: group_id,
customer_id: user.id,
title: tweet.text[0,40],
title: tweet.text[0, 40],
state_id: state_id,
priority_id: priority_id,
)

View file

@ -165,7 +165,7 @@ class Observer::Ticket::Notification::BackgroundJob
# get attribute name
attribute_name = key.to_s
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
end
@ -177,7 +177,7 @@ class Observer::Ticket::Notification::BackgroundJob
# if changed item is an _id field/reference, do an lookup for the realy values
value_id = []
value_str = [ value[0], value[1] ]
if key.to_s[-3,3] == '_id'
if key.to_s[-3, 3] == '_id'
value_id[0] = value[0]
value_id[1] = value[1]
@ -289,7 +289,7 @@ State: i18n(#{ticket.state.name.text2html})<br>
def template_update(user, ticket, article, ticket_changes)
changes = ''
ticket_changes.each {|key,value|
ticket_changes.each {|key, value|
changes += "i18n(#{key.to_s.text2html}): #{value[0].to_s.text2html} -> #{value[1].to_s.text2html}<br>\n"
}
article_content = ''
@ -339,7 +339,7 @@ Changes:<br>
end
body = template_header(user) + body
body += template_footer(user,ticket, article)
body += template_footer(user, ticket, article)
template = {
subject: subject,

View file

@ -85,7 +85,7 @@ return all online notifications of an user
=end
def self.list(user,limit)
def self.list(user, limit)
notifications = OnlineNotification.where(user_id: user.id).
order( 'created_at DESC, id DESC' ).
@ -167,7 +167,7 @@ returns:
=end
def self.list_full(user,limit)
def self.list_full(user, limit)
notifications = OnlineNotification.list(user, limit)
assets = ApplicationModel.assets_of_object_list(notifications)

View file

@ -21,7 +21,7 @@ returns
# get attribute name
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 ]
# check if attribute method exists

View file

@ -60,7 +60,7 @@ class Store::Provider::File
end
# write file to fs
def self.write_to_fs(data,sha)
def self.write_to_fs(data, sha)
# install file
permission = '600'

View file

@ -366,7 +366,7 @@ returns
=end
def self.password_reset_via_token(token,password)
def self.password_reset_via_token(token, password)
# check token
user = Token.check( action: 'PasswordReset', name: token )

View file

@ -6,6 +6,6 @@ Zammad::Application.routes.draw do
match api_path + '/networks/:id', to: 'networks#show', via: :get
match api_path + '/networks', to: 'networks#create', via: :post
match api_path + '/networks/:id', to: 'networks#update', via: :put
match api_path + '/networks/:id', to: 'networks#destroy',via: :delete
match api_path + '/networks/:id', to: 'networks#destroy', via: :delete
end

View file

@ -6,6 +6,6 @@ Zammad::Application.routes.draw do
match api_path + '/organizations/:id', to: 'organizations#show', via: :get
match api_path + '/organizations', to: 'organizations#create', via: :post
match api_path + '/organizations/:id', to: 'organizations#update', via: :put
match api_path + '/organizations/history/:id',to: 'organizations#history',via: :get
match api_path + '/organizations/history/:id', to: 'organizations#history', via: :get
end

View file

@ -5,6 +5,6 @@ Zammad::Application.routes.draw do
match api_path + '/taskbar/:id', to: 'taskbar#show', via: :get
match api_path + '/taskbar', to: 'taskbar#create', via: :post
match api_path + '/taskbar/:id', to: 'taskbar#update', via: :put
match api_path + '/taskbar/:id', to: 'taskbar#destroy',via: :delete
match api_path + '/taskbar/:id', to: 'taskbar#destroy', via: :delete
end

View file

@ -33,7 +33,7 @@ class CreateBase < ActiveRecord::Migration
t.column :last_login, :timestamp, null: true
t.column :source, :string, limit: 200, null: true
t.column :login_failed, :integer, null: false, default: 0
t.column :preferences, :string, limit: 8000,null: true
t.column :preferences, :string, limit: 8000, null: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps

View file

@ -35,10 +35,10 @@ class CreateTicket < ActiveRecord::Migration
t.references :state, null: false
t.references :organization, null: true
t.column :number, :string, limit: 60, null: false
t.column :title, :string, limit: 250,null: false
t.column :title, :string, limit: 250, null: false
t.column :owner_id, :integer, null: false
t.column :customer_id, :integer, null: false
t.column :note, :string, limit: 250,null: true
t.column :note, :string, limit: 250, null: true
t.column :first_response, :timestamp, null: true
t.column :first_response_escal_date, :timestamp, null: true
t.column :first_response_sla_time, :timestamp, null: true

View file

@ -168,7 +168,7 @@ class CreateObjectManager < ActiveRecord::Migration
null: false,
default: 2,
translate: true,
filter: [1,2,3,4,7],
filter: [1, 2, 3, 4, 7],
},
editable: false,
active: true,
@ -182,7 +182,7 @@ class CreateObjectManager < ActiveRecord::Migration
item_class: 'column',
nulloption: false,
null: true,
filter: [1,4],
filter: [1, 4],
default: 1,
},
},
@ -190,12 +190,12 @@ class CreateObjectManager < ActiveRecord::Migration
Agent: {
nulloption: false,
null: false,
filter: [2,3,4,7],
filter: [2, 3, 4, 7],
},
Customer: {
nulloption: false,
null: true,
filter: [2,4],
filter: [2, 4],
default: 2,
},
},
@ -217,10 +217,10 @@ class CreateObjectManager < ActiveRecord::Migration
null: true,
translate: true,
required_if: {
state_id: [3,7]
state_id: [3, 7]
},
shown_if: {
state_id: [3,7]
state_id: [3, 7]
},
},
editable: false,

View file

@ -43,7 +43,7 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
null: false,
default: 2,
translate: true,
filter: [1,2,3,4,7],
filter: [1, 2, 3, 4, 7],
},
editable: false,
active: true,
@ -57,7 +57,7 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
item_class: 'column',
nulloption: false,
null: true,
filter: [1,4],
filter: [1, 4],
default: 1,
},
},
@ -65,12 +65,12 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
Agent: {
nulloption: false,
null: false,
filter: [2,3,4,7],
filter: [2, 3, 4, 7],
},
Customer: {
nulloption: false,
null: true,
filter: [2,4],
filter: [2, 4],
default: 2,
},
},
@ -93,10 +93,10 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
null: true,
translate: true,
required_if: {
state_id: [3,7]
state_id: [3, 7]
},
shown_if: {
state_id: [3,7]
state_id: [3, 7]
},
},
editable: false,

View file

@ -10,7 +10,7 @@ class UpdateOverview2 < ActiveRecord::Migration
prio: 1000,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [ 1,2,3,7 ],
'tickets.state_id' => [ 1, 2, 3, 7 ],
'tickets.owner_id' => 'current_user.id',
},
order: {

View file

@ -1406,7 +1406,7 @@ Overview.create_if_not_exists(
prio: 1000,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [ 1,2,3,7 ],
'tickets.state_id' => [ 1, 2, 3, 7 ],
'tickets.owner_id' => 'current_user.id',
},
order: {
@ -1449,7 +1449,7 @@ Overview.create_if_not_exists(
prio: 1020,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [1,2,3],
'tickets.state_id' => [1, 2, 3],
'tickets.owner_id' => 1,
},
order: {
@ -1470,7 +1470,7 @@ Overview.create_if_not_exists(
prio: 1030,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [1,2,3],
'tickets.state_id' => [1, 2, 3],
},
order: {
by: 'created_at',
@ -1478,7 +1478,7 @@ Overview.create_if_not_exists(
},
view: {
d: [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
s: [ 'title', 'customer', 'group', 'state', 'owner','created_at' ],
s: [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
m: [ 'number', 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
view_mode_default: 's',
},
@ -1532,7 +1532,7 @@ Overview.create_if_not_exists(
prio: 1000,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.state_id' => [ 1, 2, 3, 4, 6 ],
'tickets.customer_id' => 'current_user.id',
},
order: {
@ -1553,7 +1553,7 @@ Overview.create_if_not_exists(
role_id: overview_role.id,
organization_shared: true,
condition: {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.state_id' => [ 1, 2, 3, 4, 6 ],
'tickets.organization_id' => 'current_user.organization_id',
},
order: {

View file

@ -2,8 +2,8 @@ class Class
def to_app_model_url
camel_cased_word = self.to_s
camel_cased_word.gsub(/::/, '_').
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
gsub(/([a-z\d])([A-Z])/, '\1_\2').
tr('-', '_').
downcase
end

View file

@ -37,13 +37,13 @@ returns
=end
def self.reverse_geocode(lat,lng)
def self.reverse_geocode(lat, lng)
# load backend
backend = self.load_adapter_by_setting( 'geo_location_backend' )
return if !backend
# db lookup
backend.reverse_geocode(lat,lng)
backend.reverse_geocode(lat, lng)
end
end

View file

@ -15,10 +15,10 @@ class GeoLocation::Gmaps
lat = result['results'].first['geometry']['location']['lat']
lng = result['results'].first['geometry']['location']['lng']
latlng = [lat,lng]
latlng = [lat, lng]
end
def self.reverse_geocode(lat,lng)
def self.reverse_geocode(lat, lng)
url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=#{lat},#{lng}&sensor=true"
response = UserAgent.get(url)
return if !response.success?

View file

@ -67,7 +67,7 @@ module Import::OTRS
required_group_ro: 'groups_ro',
required_group_rw: 'groups_rw',
}
types.each {|config_key,result_key|
types.each {|config_key, result_key|
if config[config_key]
return false if !result[result_key].has_value?( config[config_key] )
end
@ -82,7 +82,7 @@ module Import::OTRS
group_ro_role_map: 'groups_ro',
group_rw_role_map: 'groups_rw',
}
types.each {|config_key,result_key|
types.each {|config_key, result_key|
next if !config[config_key]
config[config_key].each {|otrs_group, role|
next if !result[result_key].has_value?( otrs_group )
@ -278,7 +278,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map[:Ticket].each { |key,value|
map[:Ticket].each { |key, value|
if record['Ticket'][key.to_s] && record['Ticket'][key.to_s].class == String
ticket_new[value] = Encode.conv( 'utf8', record['Ticket'][key.to_s] )
else
@ -331,7 +331,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map[:Article].each { |key,value|
map[:Article].each { |key, value|
if article[key.to_s]
article_new[value] = Encode.conv( 'utf8', article[key.to_s] )
end
@ -572,7 +572,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if state[key.to_s]
state_new[value] = state[key.to_s]
end
@ -623,7 +623,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if priority[key.to_s]
priority_new[value] = priority[key.to_s]
end
@ -667,7 +667,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if group[key.to_s]
group_new[value] = group[key.to_s]
end
@ -719,7 +719,7 @@ module Import::OTRS
source: 'OTRS Import',
role_ids: [ role.id ],
}
map.each { |key,value|
map.each { |key, value|
if user[key.to_s]
user_new[value] = user[key.to_s]
end
@ -793,7 +793,7 @@ module Import::OTRS
source: 'OTRS Import',
role_ids: [role.id],
}
map.each { |key,value|
map.each { |key, value|
if user[key.to_s]
user_new[value] = user[key.to_s]
end

View file

@ -520,7 +520,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map[:Ticket].each { |key,value|
map[:Ticket].each { |key, value|
if record[key.to_s] && record[key.to_s].class == String
ticket_new[value] = Encode.conv( 'utf8', record[key.to_s] )
else
@ -571,7 +571,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map[:Article].each { |key,value|
map[:Article].each { |key, value|
if article[key.to_s]
article_new[value] = Encode.conv( 'utf8', article[key.to_s] )
end
@ -820,7 +820,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if state.has_key?(key.to_s)
state_new[value] = state[key.to_s]
end
@ -869,7 +869,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if priority.has_key?(key.to_s)
priority_new[value] = priority[key.to_s]
end
@ -910,7 +910,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if group.has_key?(key.to_s)
group_new[value] = group[key.to_s]
end
@ -966,7 +966,7 @@ module Import::OTRS2
role_ids: role_ids,
group_ids: group_ids,
}
map.each { |key,value|
map.each { |key, value|
if user.has_key?(key.to_s)
user_new[value] = user[key.to_s]
end
@ -1091,7 +1091,7 @@ module Import::OTRS2
organization_id: get_organization_id(user, organizations),
role_ids: [ role_customer.id ],
}
map.each { |key,value|
map.each { |key, value|
if user.has_key?(key.to_s)
user_new[value] = user[key.to_s]
end
@ -1155,7 +1155,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if organization.has_key?(key.to_s)
organization_new[value] = organization[key.to_s]
end

View file

@ -7,7 +7,7 @@ module StaticAssets
data[:content] = Base64.decode64($2)
return data
end
raise "Unable to parse data url: #{data_url.substr(0,100)}"
raise "Unable to parse data url: #{data_url.substr(0, 100)}"
end
# store image 1:1

View file

@ -340,7 +340,7 @@ returns
raise "Unable to process http call '#{response.inspect}'"
end
def self.ftp(uri,options)
def self.ftp(uri, options)
host = uri.host
filename = File.basename(uri.path)
remote_dir = File.dirname(uri.path)

View file

@ -67,7 +67,7 @@ def checkForHeader(fileName)
end
#folder array
folder = ['app/assets/javascripts/app','app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ]
folder = ['app/assets/javascripts/app', 'app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ]
folder.each do |folder|
puts 'Working on folder' + folder.to_s
rbfiles = File.join("../#{folder}**", '*.{rb,coffee}')

View file

@ -76,7 +76,7 @@ if ARGV[0] == 'start' && @options[:d]
Daemons.daemonize
# create pid file
$daemon_pid = File.new( @options[:i].to_s,'w' )
$daemon_pid = File.new( @options[:i].to_s, 'w' )
$daemon_pid.sync = true
$daemon_pid.puts(Process.pid.to_s)
$daemon_pid.close

View file

@ -73,7 +73,7 @@ class TwitterTest < ActiveSupport::TestCase
ticket = Ticket.create(
group_id: group.id,
customer_id: user.id,
title: text[0,40],
title: text[0, 40],
state_id: state.id,
priority_id: priority.id,
updated_by_id: 1,

View file

@ -2153,7 +2153,7 @@ Some Text',
assert( false, "No user '#{user_result[:email]}' found!" )
return
end
user_result.each { |key,value|
user_result.each { |key, value|
if user.respond_to?( key )
assert_equal( value, user.send(key), "user check #{ key }" )
else

View file

@ -407,7 +407,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
)
# check changed attributes
human_changes = bg.human_changes(agent1,ticket1)
human_changes = bg.human_changes(agent1, ticket1)
assert( human_changes['Priority'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert( human_changes['Pending till'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert_equal( 'i18n(1 low)', human_changes['Priority'][0] )
@ -511,7 +511,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
puts "hc #{human_changes.inspect}"
# check changed attributes
human_changes = bg.human_changes(agent1,ticket1)
human_changes = bg.human_changes(agent1, ticket1)
assert( human_changes['Title'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert( human_changes['Priority'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert_equal( 'i18n(2 normal)', human_changes['Priority'][0] )
@ -522,7 +522,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
assert_not( human_changes['pending_time'] )
assert_not( human_changes['pending_till'] )
human_changes = bg.human_changes(agent2,ticket1)
human_changes = bg.human_changes(agent2, ticket1)
puts "hc2 #{human_changes.inspect}"
template = bg.template_update(agent1, ticket1, article, human_changes)