Corrected with rubocop cop 'Style/WordArray'.
This commit is contained in:
parent
f982288eb4
commit
b3b76acc89
29 changed files with 59 additions and 67 deletions
|
@ -215,11 +215,6 @@ Style/SignalException:
|
|||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
|
||||
Enabled: false
|
||||
|
||||
Style/WordArray:
|
||||
Description: 'Use %w or %W for arrays of words.'
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
|
||||
Enabled: false
|
||||
|
||||
Metrics/AbcSize:
|
||||
Description: >-
|
||||
A calculated magnitude based on number of assignments,
|
||||
|
|
|
@ -75,10 +75,7 @@ class IcalTicketsController < ApplicationController
|
|||
'tickets.owner_id' => current_user.id,
|
||||
'tickets.state_id' => Ticket::State.where(
|
||||
state_type_id: Ticket::StateType.where(
|
||||
name: [
|
||||
'new',
|
||||
'open',
|
||||
],
|
||||
name: %w(new open),
|
||||
),
|
||||
),
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class SearchController < ApplicationController
|
|||
assets = {}
|
||||
result = []
|
||||
if SearchIndexBackend.enabled?
|
||||
items = SearchIndexBackend.search( query, limit, ['User', 'Organization'] )
|
||||
items = SearchIndexBackend.search( query, limit, %w(User Organization) )
|
||||
items.each { |item|
|
||||
require item[:type].to_filename
|
||||
record = Kernel.const_get( item[:type] ).find( item[:id] )
|
||||
|
|
|
@ -30,7 +30,7 @@ returns
|
|||
end
|
||||
|
||||
return data if !self['created_by_id'] && !self['updated_by_id']
|
||||
['created_by_id', 'updated_by_id'].each {|item|
|
||||
%w(created_by_id updated_by_id).each {|item|
|
||||
next if !self[ item ]
|
||||
if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self[ item ] ]
|
||||
user = User.lookup( id: self[ item ] )
|
||||
|
|
|
@ -72,7 +72,7 @@ returns
|
|||
|
||||
def search_index_data
|
||||
attributes = {}
|
||||
['name', 'note'].each { |key|
|
||||
%w(name note).each { |key|
|
||||
if self[key] && !self[key].empty?
|
||||
attributes[key] = self[key]
|
||||
end
|
||||
|
|
|
@ -503,7 +503,7 @@ class Channel::EmailParser
|
|||
roles = Role.where( name: 'Customer' )
|
||||
|
||||
# fillup
|
||||
['firstname', 'lastname'].each { |item|
|
||||
%w(firstname lastname).each { |item|
|
||||
if data[item.to_sym] == nil
|
||||
data[item.to_sym] = ''
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ list all backend managed object
|
|||
=end
|
||||
|
||||
def self.list_objects
|
||||
['Ticket', 'TicketArticle', 'User', 'Organization', 'Group' ]
|
||||
%w(Ticket TicketArticle User Organization Group)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
@ -23,7 +23,7 @@ list all frontend managed object
|
|||
=end
|
||||
|
||||
def self.list_frontend_objects
|
||||
['Ticket', 'User', 'Organization' ] #, 'Group' ]
|
||||
%w(Ticket User Organization) #, 'Group' ]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ class Observer::User::Geo < ActiveRecord::Observer
|
|||
# check if geo need to be updated
|
||||
def check_geo(record)
|
||||
|
||||
location = ['street', 'zip', 'city', 'country']
|
||||
location = %w(street zip city country)
|
||||
|
||||
# check if geo update is needed based on old/new location
|
||||
if record.id
|
||||
|
@ -42,7 +42,7 @@ class Observer::User::Geo < ActiveRecord::Observer
|
|||
# update geo data of user
|
||||
def geo_update(record)
|
||||
address = ''
|
||||
location = ['street', 'zip', 'city', 'country']
|
||||
location = %w(street zip city country)
|
||||
location.each { |item|
|
||||
if record[item] && record[item] != ''
|
||||
address = address + ',' + record[item]
|
||||
|
|
|
@ -40,7 +40,7 @@ returns
|
|||
}
|
||||
end
|
||||
end
|
||||
['created_by_id', 'updated_by_id'].each {|item|
|
||||
%w(created_by_id updated_by_id).each {|item|
|
||||
next if !self[ item ]
|
||||
if !data[ User.to_app_model ][ self[ item ] ]
|
||||
user = User.lookup( id: self[ item ] )
|
||||
|
|
|
@ -311,7 +311,7 @@ class Package < ApplicationModel
|
|||
|
||||
# reload .rb files in case they have changed
|
||||
def self.reload_classes
|
||||
['app', 'lib'].each {|dir|
|
||||
%w(app lib).each {|dir|
|
||||
Dir.glob( Rails.root.join( dir + '/**/*') ).each {|entry|
|
||||
if entry =~ /\.rb$/
|
||||
begin
|
||||
|
|
|
@ -41,7 +41,7 @@ returns
|
|||
data[ Ticket::Article.to_app_model ][ self.id ]['attachments'] = self.attachments
|
||||
end
|
||||
|
||||
['created_by_id', 'updated_by_id'].each {|item|
|
||||
%w(created_by_id updated_by_id).each {|item|
|
||||
next if !self[ item ]
|
||||
if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self[ item ] ]
|
||||
user = User.lookup( id: self[ item ] )
|
||||
|
|
|
@ -29,7 +29,7 @@ returns
|
|||
if !data[ Ticket.to_app_model ][ self.id ]
|
||||
data[ Ticket.to_app_model ][ self.id ] = self.attributes_with_associations
|
||||
end
|
||||
['created_by_id', 'updated_by_id', 'owner_id', 'customer_id'].each {|item|
|
||||
%w(created_by_id updated_by_id owner_id customer_id).each {|item|
|
||||
next if !self[ item ]
|
||||
if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self[ item ] ]
|
||||
user = User.lookup( id: self[ item ] )
|
||||
|
|
|
@ -83,7 +83,7 @@ returns
|
|||
|
||||
type_ids = []
|
||||
if params[:ticket]
|
||||
types = ['note', 'phone']
|
||||
types = %w(note phone)
|
||||
if params[:ticket].group.email_address_id
|
||||
types.push 'email'
|
||||
end
|
||||
|
|
|
@ -63,7 +63,7 @@ returns
|
|||
article_attributes = article.attributes
|
||||
|
||||
# remove note needed attributes
|
||||
ignore = ['created_by_id', 'updated_by_id', 'updated_at', 'references', 'message_id_md5', 'message_id', 'in_reply_to', 'ticket_id']
|
||||
ignore = %w(created_by_id updated_by_id updated_at references message_id_md5 message_id in_reply_to ticket_id)
|
||||
ignore.each {|attribute|
|
||||
article_attributes.delete( attribute )
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ returns:
|
|||
=end
|
||||
|
||||
def ignore_escalation?
|
||||
ignore_escalation = ['removed', 'closed', 'merged']
|
||||
ignore_escalation = %w(removed closed merged)
|
||||
return true if ignore_escalation.include?( self.name )
|
||||
false
|
||||
end
|
||||
|
|
|
@ -74,7 +74,7 @@ returns
|
|||
data = organization.assets( data )
|
||||
end
|
||||
end
|
||||
['created_by_id', 'updated_by_id'].each {|item|
|
||||
%w(created_by_id updated_by_id).each {|item|
|
||||
next if !self[ item ]
|
||||
if !data[ User.to_app_model ][ self[ item ] ]
|
||||
user = User.lookup( id: self[ item ] )
|
||||
|
|
|
@ -18,7 +18,7 @@ returns
|
|||
|
||||
def search_index_data
|
||||
attributes = { 'fullname' => "#{ self['firstname'] } #{ self['lastname'] }" }
|
||||
['login', 'firstname', 'lastname', 'phone', 'email', 'city', 'country', 'note', 'created_at'].each { |key|
|
||||
%w(login firstname lastname phone email city country note created_at).each { |key|
|
||||
if self[key] && (!self.respond_to?('empty?') || !self[key].empty?)
|
||||
attributes[key] = self[key]
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ class UpdateAuth < ActiveRecord::Migration
|
|||
uid: 'mail',
|
||||
base: 'dc=example,dc=org',
|
||||
always_filter: '',
|
||||
always_roles: ['Admin', 'Agent'],
|
||||
always_roles: %w(Admin Agent),
|
||||
always_groups: ['Users'],
|
||||
sync_params: {
|
||||
firstname: 'sn',
|
||||
|
|
|
@ -23,9 +23,9 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
s: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'created_at' ],
|
||||
d: %w(title customer group created_at),
|
||||
s: %w(title customer group created_at),
|
||||
m: %w(number title customer group created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ class CreateAddress < ActiveRecord::Migration
|
|||
end
|
||||
}
|
||||
|
||||
['street', 'zip', 'city', 'department'].each {|attribute_name|
|
||||
%w(street zip city department).each {|attribute_name|
|
||||
attribute = ObjectManager::Attribute.get(
|
||||
object: 'User',
|
||||
name: attribute_name,
|
||||
|
|
|
@ -20,9 +20,9 @@ class UpdateOverview2 < ActiveRecord::Migration
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
s: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'created_at' ],
|
||||
d: %w(title customer group created_at),
|
||||
s: %w(title customer group created_at),
|
||||
m: %w(number title customer group created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
|
50
db/seeds.rb
50
db/seeds.rb
|
@ -363,7 +363,7 @@ Setting.create_if_not_exists(
|
|||
uid: 'mail',
|
||||
base: 'dc=example,dc=org',
|
||||
always_filter: '',
|
||||
always_roles: ['Admin', 'Agent'],
|
||||
always_roles: %w(Admin Agent),
|
||||
always_groups: ['Users'],
|
||||
sync_params: {
|
||||
firstname: 'sn',
|
||||
|
@ -1432,9 +1432,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
s: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'created_at' ],
|
||||
d: %w(title customer group created_at),
|
||||
s: %w(title customer group created_at),
|
||||
m: %w(number title customer group created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
@ -1454,9 +1454,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
s: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'created_at' ],
|
||||
d: %w(title customer group created_at),
|
||||
s: %w(title customer group created_at),
|
||||
m: %w(number title customer group created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
@ -1475,9 +1475,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
s: [ 'title', 'customer', 'group', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'created_at' ],
|
||||
d: %w(title customer group created_at),
|
||||
s: %w(title customer group created_at),
|
||||
m: %w(number title customer group created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
@ -1495,9 +1495,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
|
||||
s: [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
|
||||
d: %w(title customer group state owner created_at),
|
||||
s: %w(title customer group state owner created_at),
|
||||
m: %w(number title customer group state owner created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
@ -1516,9 +1516,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'owner', 'created_at' ],
|
||||
s: [ 'title', 'customer', 'group', 'owner', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'owner', 'created_at' ],
|
||||
d: %w(title customer group owner created_at),
|
||||
s: %w(title customer group owner created_at),
|
||||
m: %w(number title customer group owner created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
@ -1536,9 +1536,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'ASC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'group', 'owner', 'escalation_time' ],
|
||||
s: [ 'title', 'customer', 'group', 'owner', 'escalation_time' ],
|
||||
m: [ 'number', 'title', 'customer', 'group', 'owner', 'escalation_time' ],
|
||||
d: %w(title customer group owner escalation_time),
|
||||
s: %w(title customer group owner escalation_time),
|
||||
m: %w(number title customer group owner escalation_time),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
@ -1558,9 +1558,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'DESC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'state', 'created_at' ],
|
||||
s: [ 'number', 'title', 'state', 'created_at' ],
|
||||
m: [ 'number', 'title', 'state', 'created_at' ],
|
||||
d: %w(title customer state created_at),
|
||||
s: %w(number title state created_at),
|
||||
m: %w(number title state created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
@ -1579,9 +1579,9 @@ Overview.create_if_not_exists(
|
|||
direction: 'DESC',
|
||||
},
|
||||
view: {
|
||||
d: [ 'title', 'customer', 'state', 'created_at' ],
|
||||
s: [ 'number', 'title', 'customer', 'state', 'created_at' ],
|
||||
m: [ 'number', 'title', 'customer', 'state', 'created_at' ],
|
||||
d: %w(title customer state created_at),
|
||||
s: %w(number title customer state created_at),
|
||||
m: %w(number title customer state created_at),
|
||||
view_mode_default: 's',
|
||||
},
|
||||
)
|
||||
|
|
|
@ -34,7 +34,7 @@ returns
|
|||
# create Users
|
||||
if auto_wizard_hash['Users']
|
||||
|
||||
roles = Role.where( name: ['Agent', 'Admin'] )
|
||||
roles = Role.where( name: %w(Agent Admin) )
|
||||
groups = Group.all
|
||||
|
||||
auto_wizard_hash['Users'].each { |user_data|
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'test_helper'
|
|||
class AssetsTest < ActiveSupport::TestCase
|
||||
test 'user' do
|
||||
|
||||
roles = Role.where( name: [ 'Agent', 'Admin'] )
|
||||
roles = Role.where( name: %w(Agent Admin) )
|
||||
groups = Group.all
|
||||
org = Organization.create_or_update(
|
||||
name: 'some org',
|
||||
|
|
|
@ -15,7 +15,7 @@ Setting.create_or_update(
|
|||
uid: 'mail',
|
||||
base: 'dc=example,dc=org',
|
||||
always_filter: '',
|
||||
always_roles: ['Admin', 'Agent'],
|
||||
always_roles: %w(Admin Agent),
|
||||
always_groups: ['Users'],
|
||||
sync_params: {
|
||||
firstname: 'sn',
|
||||
|
|
|
@ -12,7 +12,7 @@ class RestTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
# create agent
|
||||
roles = Role.where( name: ['Admin', 'Agent'] )
|
||||
roles = Role.where( name: %w(Admin Agent) )
|
||||
groups = Group.all
|
||||
|
||||
UserInfo.current_user_id = 1
|
||||
|
|
|
@ -181,7 +181,7 @@ class SessionBasicTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
user = User.lookup(id: 1)
|
||||
roles = Role.where( name: [ 'Agent', 'Admin'] )
|
||||
roles = Role.where( name: %w(Agent Admin) )
|
||||
user.roles = roles
|
||||
user.save
|
||||
|
||||
|
@ -258,7 +258,7 @@ class SessionBasicTest < ActiveSupport::TestCase
|
|||
test 'c activity stream' do
|
||||
|
||||
# create users
|
||||
roles = Role.where( name: [ 'Agent', 'Admin'] )
|
||||
roles = Role.where( name: %w(Agent Admin) )
|
||||
groups = Group.all
|
||||
|
||||
UserInfo.current_user_id = 2
|
||||
|
|
|
@ -9,7 +9,7 @@ class SessionCollectionsTest < ActiveSupport::TestCase
|
|||
UserInfo.current_user_id = 1
|
||||
|
||||
# create users
|
||||
roles = Role.where( name: [ 'Agent', 'Admin'] )
|
||||
roles = Role.where( name: %w(Agent Admin) )
|
||||
groups = Group.all
|
||||
|
||||
agent1 = User.create_or_update(
|
||||
|
|
|
@ -49,7 +49,7 @@ class TicketSlaTest < ActiveSupport::TestCase
|
|||
|
||||
sla = Sla.create(
|
||||
name: 'test sla 2',
|
||||
condition: { 'tickets.priority_id' => ['1', '2', '3'] },
|
||||
condition: { 'tickets.priority_id' => %w(1 2 3) },
|
||||
data: {
|
||||
'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
|
||||
'beginning_of_workday' => '8:00',
|
||||
|
|
Loading…
Reference in a new issue