From 16ddef38e92a81c686a162b2c226d622f04b3413 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 27 Apr 2015 16:53:29 +0200 Subject: [PATCH] Applied rubocop Style/SpaceAfterComma. --- .../online_notifications_controller.rb | 2 +- app/controllers/taskbar_controller.rb | 2 +- app/models/activity_stream.rb | 2 +- app/models/application_model.rb | 8 ++++---- .../application_model/search_index_base.rb | 2 +- app/models/channel/email_parser.rb | 2 +- app/models/channel/imap.rb | 4 ++-- app/models/channel/twitter2.rb | 2 +- .../ticket/notification/background_job.rb | 8 ++++---- app/models/online_notification.rb | 4 ++-- app/models/organization/search_index.rb | 2 +- app/models/store/provider/file.rb | 2 +- app/models/user.rb | 2 +- config/routes/network.rb | 2 +- config/routes/organization.rb | 2 +- config/routes/taskbar.rb | 2 +- db/migrate/20120101000001_create_base.rb | 2 +- db/migrate/20120101000010_create_ticket.rb | 4 ++-- .../20140831000001_create_object_manager.rb | 12 ++++++------ ...2000001_update_overview_and_ticket_state.rb | 12 ++++++------ db/migrate/20150223000001_update_overview2.rb | 2 +- db/seeds.rb | 12 ++++++------ lib/core_ext/class.rb | 4 ++-- lib/geo_location.rb | 4 ++-- lib/geo_location/gmaps.rb | 4 ++-- lib/import/otrs.rb | 18 +++++++++--------- lib/import/otrs2.rb | 16 ++++++++-------- lib/static_assets.rb | 2 +- lib/user_agent.rb | 2 +- script/source_code_filter.rb | 2 +- script/websocket-server.rb | 2 +- test/integration/twitter_test.rb | 2 +- test/unit/email_process_test.rb | 2 +- test/unit/ticket_notification_test.rb | 6 +++--- 34 files changed, 78 insertions(+), 78 deletions(-) diff --git a/app/controllers/online_notifications_controller.rb b/app/controllers/online_notifications_controller.rb index dad949b83..e1655f387 100644 --- a/app/controllers/online_notifications_controller.rb +++ b/app/controllers/online_notifications_controller.rb @@ -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'] ) diff --git a/app/controllers/taskbar_controller.rb b/app/controllers/taskbar_controller.rb index 378907aaf..49da083c7 100644 --- a/app/controllers/taskbar_controller.rb +++ b/app/controllers/taskbar_controller.rb @@ -18,7 +18,7 @@ class TaskbarController < ApplicationController end def create - model_create_render(Taskbar,params) + model_create_render(Taskbar, params) end def update diff --git a/app/models/activity_stream.rb b/app/models/activity_stream.rb index 45f2d17c5..9b2a551e0 100644 --- a/app/models/activity_stream.rb +++ b/app/models/activity_stream.rb @@ -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 diff --git a/app/models/application_model.rb b/app/models/application_model.rb index 1f82b3dd9..54e68f8a0 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -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] diff --git a/app/models/application_model/search_index_base.rb b/app/models/application_model/search_index_base.rb index 802498750..c5ad7fb81 100644 --- a/app/models/application_model/search_index_base.rb +++ b/app/models/application_model/search_index_base.rb @@ -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 diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index e56b9c990..526f97e37 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -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' diff --git a/app/models/channel/imap.rb b/app/models/channel/imap.rb index 7e90f55e2..41c57db7a 100644 --- a/app/models/channel/imap.rb +++ b/app/models/channel/imap.rb @@ -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 diff --git a/app/models/channel/twitter2.rb b/app/models/channel/twitter2.rb index 8fa40f12b..9b794f0d1 100644 --- a/app/models/channel/twitter2.rb +++ b/app/models/channel/twitter2.rb @@ -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, ) diff --git a/app/models/observer/ticket/notification/background_job.rb b/app/models/observer/ticket/notification/background_job.rb index e341b9fec..c9ddcca46 100644 --- a/app/models/observer/ticket/notification/background_job.rb +++ b/app/models/observer/ticket/notification/background_job.rb @@ -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})
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}
\n" } article_content = '' @@ -339,7 +339,7 @@ Changes:
end body = template_header(user) + body - body += template_footer(user,ticket, article) + body += template_footer(user, ticket, article) template = { subject: subject, diff --git a/app/models/online_notification.rb b/app/models/online_notification.rb index 2abe8333c..a1c2bfa9d 100644 --- a/app/models/online_notification.rb +++ b/app/models/online_notification.rb @@ -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) diff --git a/app/models/organization/search_index.rb b/app/models/organization/search_index.rb index 2df2b46e8..33421f9d6 100644 --- a/app/models/organization/search_index.rb +++ b/app/models/organization/search_index.rb @@ -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 diff --git a/app/models/store/provider/file.rb b/app/models/store/provider/file.rb index 5b2534b79..fdcc8a562 100644 --- a/app/models/store/provider/file.rb +++ b/app/models/store/provider/file.rb @@ -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' diff --git a/app/models/user.rb b/app/models/user.rb index 4ca5839b4..ef23209fe 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 ) diff --git a/config/routes/network.rb b/config/routes/network.rb index 345a277d6..f3b6ecd7f 100644 --- a/config/routes/network.rb +++ b/config/routes/network.rb @@ -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 diff --git a/config/routes/organization.rb b/config/routes/organization.rb index ad54d47f9..ead3b0193 100644 --- a/config/routes/organization.rb +++ b/config/routes/organization.rb @@ -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 diff --git a/config/routes/taskbar.rb b/config/routes/taskbar.rb index 0a9765352..b63457537 100644 --- a/config/routes/taskbar.rb +++ b/config/routes/taskbar.rb @@ -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 diff --git a/db/migrate/20120101000001_create_base.rb b/db/migrate/20120101000001_create_base.rb index 2f8d2db7e..976c7fdfe 100644 --- a/db/migrate/20120101000001_create_base.rb +++ b/db/migrate/20120101000001_create_base.rb @@ -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 diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 0a7e94b59..bcd9be345 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -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 diff --git a/db/migrate/20140831000001_create_object_manager.rb b/db/migrate/20140831000001_create_object_manager.rb index 869f1ba07..d77192158 100644 --- a/db/migrate/20140831000001_create_object_manager.rb +++ b/db/migrate/20140831000001_create_object_manager.rb @@ -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, diff --git a/db/migrate/20150112000001_update_overview_and_ticket_state.rb b/db/migrate/20150112000001_update_overview_and_ticket_state.rb index e7aa0e6d0..f60759d10 100644 --- a/db/migrate/20150112000001_update_overview_and_ticket_state.rb +++ b/db/migrate/20150112000001_update_overview_and_ticket_state.rb @@ -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, diff --git a/db/migrate/20150223000001_update_overview2.rb b/db/migrate/20150223000001_update_overview2.rb index d51be1b9f..18ecac3bf 100644 --- a/db/migrate/20150223000001_update_overview2.rb +++ b/db/migrate/20150223000001_update_overview2.rb @@ -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: { diff --git a/db/seeds.rb b/db/seeds.rb index 2b4aeca3a..806e074ac 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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: { diff --git a/lib/core_ext/class.rb b/lib/core_ext/class.rb index 0b6ac9185..896ad94a8 100644 --- a/lib/core_ext/class.rb +++ b/lib/core_ext/class.rb @@ -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 diff --git a/lib/geo_location.rb b/lib/geo_location.rb index b18df5560..40ac95c35 100644 --- a/lib/geo_location.rb +++ b/lib/geo_location.rb @@ -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 diff --git a/lib/geo_location/gmaps.rb b/lib/geo_location/gmaps.rb index 2f125c7e9..7265ed49b 100644 --- a/lib/geo_location/gmaps.rb +++ b/lib/geo_location/gmaps.rb @@ -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? diff --git a/lib/import/otrs.rb b/lib/import/otrs.rb index b92bca452..b9e08326b 100644 --- a/lib/import/otrs.rb +++ b/lib/import/otrs.rb @@ -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 diff --git a/lib/import/otrs2.rb b/lib/import/otrs2.rb index 8d27ee3d2..d62a5d896 100644 --- a/lib/import/otrs2.rb +++ b/lib/import/otrs2.rb @@ -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 diff --git a/lib/static_assets.rb b/lib/static_assets.rb index d05b4eb76..7ebda92de 100644 --- a/lib/static_assets.rb +++ b/lib/static_assets.rb @@ -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 diff --git a/lib/user_agent.rb b/lib/user_agent.rb index 48806c65b..a92fed14f 100644 --- a/lib/user_agent.rb +++ b/lib/user_agent.rb @@ -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) diff --git a/script/source_code_filter.rb b/script/source_code_filter.rb index 6fb5f3db2..81a8fd3ac 100755 --- a/script/source_code_filter.rb +++ b/script/source_code_filter.rb @@ -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}') diff --git a/script/websocket-server.rb b/script/websocket-server.rb index fca06f6fc..75c18eba6 100755 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -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 diff --git a/test/integration/twitter_test.rb b/test/integration/twitter_test.rb index 112da0d52..bda96f896 100644 --- a/test/integration/twitter_test.rb +++ b/test/integration/twitter_test.rb @@ -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, diff --git a/test/unit/email_process_test.rb b/test/unit/email_process_test.rb index 2f485695a..248f73e51 100644 --- a/test/unit/email_process_test.rb +++ b/test/unit/email_process_test.rb @@ -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 diff --git a/test/unit/ticket_notification_test.rb b/test/unit/ticket_notification_test.rb index 75505aa6b..5611cfd9e 100644 --- a/test/unit/ticket_notification_test.rb +++ b/test/unit/ticket_notification_test.rb @@ -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)