Bumps [rubocop-performance](https://github.com/rubocop-hq/rubocop-performance) from 1.1.0 to 1.4.1.
- [Release notes](https://github.com/rubocop-hq/rubocop-performance/releases) - [Changelog](https://github.com/rubocop-hq/rubocop-performance/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop-performance/compare/v1.1.0...v1.4.1)
This commit is contained in:
parent
429b95e65d
commit
1c63e96675
36 changed files with 51 additions and 51 deletions
|
@ -448,8 +448,8 @@ GEM
|
|||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
rubocop-performance (1.1.0)
|
||||
rubocop (>= 0.67.0)
|
||||
rubocop-performance (1.4.1)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.3.2)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
|
|
|
@ -303,7 +303,7 @@ curl http://localhost/api/v1/monitoring/amount_check?token=XXX&periode=1h
|
|||
raise Exceptions::UnprocessableEntity, 'periode is missing!' if params[:periode].blank?
|
||||
|
||||
scale = params[:periode][-1, 1]
|
||||
raise Exceptions::UnprocessableEntity, 'periode need to have s, m, h or d as last!' if scale !~ /^(s|m|h|d)$/
|
||||
raise Exceptions::UnprocessableEntity, 'periode need to have s, m, h or d as last!' if !scale.match?(/^(s|m|h|d)$/)
|
||||
|
||||
periode = params[:periode][0, params[:periode].length - 1]
|
||||
raise Exceptions::UnprocessableEntity, 'periode need to be an integer!' if periode.to_i.zero?
|
||||
|
|
|
@ -182,7 +182,7 @@ example
|
|||
# check if verify message exists
|
||||
subject = message_meta['ENVELOPE'].subject
|
||||
next if !subject
|
||||
next if subject !~ /#{verify_string}/
|
||||
next if !subject.match?(/#{verify_string}/)
|
||||
|
||||
Rails.logger.info " - verify email #{verify_string} found"
|
||||
timeout(600) do
|
||||
|
|
|
@ -117,7 +117,7 @@ returns
|
|||
next if !mail
|
||||
|
||||
# check if verify message exists
|
||||
next if mail !~ /#{verify_string}/
|
||||
next if !mail.match?(/#{verify_string}/)
|
||||
|
||||
Rails.logger.info " - verify email #{verify_string} found"
|
||||
m.delete
|
||||
|
|
|
@ -734,7 +734,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
|||
'image/gif': %w[gif image],
|
||||
}
|
||||
map.each do |type, ext|
|
||||
next if headers_store['Content-Type'] !~ /^#{Regexp.quote(type)}/i
|
||||
next if !headers_store['Content-Type'].match?(/^#{Regexp.quote(type)}/i)
|
||||
|
||||
filename = if headers_store['Content-Description'].present?
|
||||
"#{headers_store['Content-Description']}.#{ext[0]}".to_s.force_encoding('utf-8')
|
||||
|
|
|
@ -8,7 +8,7 @@ module Channel::Filter::FollowUpPossibleCheck
|
|||
|
||||
ticket = Ticket.lookup(id: ticket_id)
|
||||
return true if !ticket
|
||||
return true if ticket.state.state_type.name !~ /^(closed|merged|removed)/i
|
||||
return true if !ticket.state.state_type.name.match?(/^(closed|merged|removed)/i)
|
||||
|
||||
# in case of closed tickets, remove follow-up information
|
||||
case ticket.group.follow_up_possible
|
||||
|
|
|
@ -104,7 +104,7 @@ module Channel::Filter::IdentifySender
|
|||
items.each do |address_data|
|
||||
email_address = address_data.address
|
||||
next if email_address.blank?
|
||||
next if email_address !~ /@/
|
||||
next if !email_address.match?(/@/)
|
||||
next if email_address.match?(/\s/)
|
||||
|
||||
user_create(
|
||||
|
@ -132,7 +132,7 @@ module Channel::Filter::IdentifySender
|
|||
display_name = $1
|
||||
end
|
||||
next if address.blank?
|
||||
next if address !~ /@/
|
||||
next if !address.match?(/@/)
|
||||
next if address.match?(/\s/)
|
||||
|
||||
user_create(
|
||||
|
|
|
@ -8,7 +8,7 @@ module Channel::Filter::OutOfOfficeCheck
|
|||
|
||||
# check ms out of office characteristics
|
||||
if mail[ 'x-auto-response-suppress'.to_sym ]
|
||||
return if mail[ 'x-auto-response-suppress'.to_sym ] !~ /all/i
|
||||
return if !mail[ 'x-auto-response-suppress'.to_sym ].match?(/all/i)
|
||||
return if !mail[ 'x-ms-exchange-inbox-rules-loop'.to_sym ]
|
||||
|
||||
mail[ 'x-zammad-out-of-office'.to_sym ] = true
|
||||
|
|
|
@ -9,10 +9,10 @@ module Channel::Filter::OwnNotificationLoopDetection
|
|||
|
||||
recedence = mail['precedence'.to_sym]
|
||||
return if !recedence
|
||||
return if recedence !~ /bulk/i
|
||||
return if !recedence.match?(/bulk/i)
|
||||
|
||||
fqdn = Setting.get('fqdn')
|
||||
return if message_id !~ /@#{Regexp.quote(fqdn)}>/i
|
||||
return if !message_id.match?(/@#{Regexp.quote(fqdn)}>/i)
|
||||
|
||||
mail[ 'x-zammad-ignore'.to_sym ] = true
|
||||
Rails.logger.info "Detected own sent notification mail and dropped it to prevent loops (message_id: #{message_id}, from: #{mail[:from]}, to: #{mail[:to]})"
|
||||
|
|
|
@ -8,7 +8,7 @@ module Channel::Filter::Trusted
|
|||
# check if trust x-headers
|
||||
if !channel[:trusted]
|
||||
mail.each_key do |key|
|
||||
next if key !~ /^x-zammad/i
|
||||
next if !key.match?(/^x-zammad/i)
|
||||
|
||||
mail.delete(key)
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ module Channel::Filter::Trusted
|
|||
|
||||
# verify values
|
||||
mail.each do |key, value|
|
||||
next if key !~ /^x-zammad/i
|
||||
next if !key.match?(/^x-zammad/i)
|
||||
|
||||
# no assoc exists, remove header
|
||||
next if Channel::EmailParser.check_attributes_by_x_headers(key, value)
|
||||
|
|
|
@ -75,7 +75,7 @@ returns
|
|||
|
||||
# check order
|
||||
params[:order_by].each do |value|
|
||||
raise "Found invalid order by value #{value}. Please use 'asc' or 'desc'." if value !~ /\A(asc|desc)\z/i
|
||||
raise "Found invalid order by value #{value}. Please use 'asc' or 'desc'." if !value.match?(/\A(asc|desc)\z/i)
|
||||
|
||||
order_by.push(value.downcase)
|
||||
end
|
||||
|
|
|
@ -94,7 +94,7 @@ class Cti::Driver::Base
|
|||
if routing_table.present?
|
||||
routing_table.each do |row|
|
||||
dest = row[:dest].gsub(/\*/, '.+?')
|
||||
next if to !~ /^#{dest}$/
|
||||
next if !to.match?(/^#{dest}$/)
|
||||
|
||||
return {
|
||||
action: 'set_caller_id',
|
||||
|
|
|
@ -48,7 +48,7 @@ check and if channel not exists reset configured channels for email addresses
|
|||
return true if email.blank?
|
||||
|
||||
self.email = email.downcase.strip
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid email' if email !~ /@/
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid email' if !email.match?(/@/)
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid email' if email.match?(/\s/)
|
||||
|
||||
true
|
||||
|
|
|
@ -23,7 +23,7 @@ class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
|
|||
|
||||
type = Ticket::Article::Type.lookup(id: record.type_id)
|
||||
return true if type.nil?
|
||||
return true if type.name !~ /\Afacebook/
|
||||
return true if !type.name.start_with?('facebook')
|
||||
|
||||
Delayed::Job.enqueue(Observer::Ticket::Article::CommunicateFacebook::BackgroundJob.new(record.id))
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class Observer::Ticket::Article::CommunicateFacebook::BackgroundJob
|
|||
log_error(article, "Can't find ticket.preferences for Ticket.find(#{article.ticket_id})") if !ticket.preferences
|
||||
log_error(article, "Can't find ticket.preferences['channel_id'] for Ticket.find(#{article.ticket_id})") if !ticket.preferences['channel_id']
|
||||
channel = Channel.lookup(id: ticket.preferences['channel_id'])
|
||||
log_error(article, "Channel.find(#{channel.id}) isn't a twitter channel!") if channel.options[:adapter] !~ /\Afacebook/i
|
||||
log_error(article, "Channel.find(#{channel.id}) isn't a twitter channel!") if !channel.options[:adapter].match?(/\Afacebook/i)
|
||||
|
||||
# check source object id
|
||||
if !ticket.preferences['channel_fb_object_id']
|
||||
|
|
|
@ -19,7 +19,7 @@ class Observer::Ticket::Article::CommunicateTelegram < ActiveRecord::Observer
|
|||
return true if !record.type_id
|
||||
|
||||
type = Ticket::Article::Type.lookup(id: record.type_id)
|
||||
return true if type.name !~ /\Atelegram/i
|
||||
return true if !type.name.match?(/\Atelegram/i)
|
||||
|
||||
Delayed::Job.enqueue(Observer::Ticket::Article::CommunicateTelegram::BackgroundJob.new(record.id))
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer
|
|||
|
||||
type = Ticket::Article::Type.lookup(id: record.type_id)
|
||||
return true if type.nil?
|
||||
return true if type.name !~ /\Atwitter/i
|
||||
return true if !type.name.match?(/\Atwitter/i)
|
||||
|
||||
raise Exceptions::UnprocessableEntity, 'twitter to: parameter is missing' if record.to.blank? && type['name'] == 'twitter direct-message'
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
|
|||
end
|
||||
|
||||
log_error(article, "No such channel id #{ticket.preferences['channel_id']}") if !channel
|
||||
log_error(article, "Channel.find(#{channel.id}) isn't a twitter channel!") if channel.options[:adapter] !~ /\Atwitter/i
|
||||
log_error(article, "Channel.find(#{channel.id}) isn't a twitter channel!") if !channel.options[:adapter].match?(/\Atwitter/i)
|
||||
|
||||
begin
|
||||
tweet = channel.deliver(
|
||||
|
|
|
@ -523,7 +523,7 @@ execute all pending package migrations at once
|
|||
end
|
||||
|
||||
migrations_existing.each do |migration|
|
||||
next if migration !~ /\.rb$/
|
||||
next if !migration.match?(/\.rb$/)
|
||||
|
||||
version = nil
|
||||
name = nil
|
||||
|
|
|
@ -568,7 +568,7 @@ condition example
|
|||
|
||||
selector = selector_raw.stringify_keys
|
||||
raise "Invalid selector, operator missing #{selector.inspect}" if !selector['operator']
|
||||
raise "Invalid selector, operator #{selector['operator']} is invalid #{selector.inspect}" if selector['operator'] !~ /^(is|is\snot|contains|contains\s(not|all|one|all\snot|one\snot)|(after|before)\s\(absolute\)|(within\snext|within\slast|after|before)\s\(relative\))$/
|
||||
raise "Invalid selector, operator #{selector['operator']} is invalid #{selector.inspect}" if !selector['operator'].match?(/^(is|is\snot|contains|contains\s(not|all|one|all\snot|one\snot)|(after|before)\s\(absolute\)|(within\snext|within\slast|after|before)\s\(relative\))$/)
|
||||
|
||||
# validate value / allow blank but only if pre_condition exists and is not specific
|
||||
if !selector.key?('value') ||
|
||||
|
@ -1358,7 +1358,7 @@ result
|
|||
|
||||
# send notifications only to email addresses
|
||||
next if recipient_email.blank?
|
||||
next if recipient_email !~ /@/
|
||||
next if !recipient_email.match?(/@/)
|
||||
|
||||
# check if address is valid
|
||||
begin
|
||||
|
@ -1375,7 +1375,7 @@ result
|
|||
recipient_email = "#{$2}@#{$3}"
|
||||
end
|
||||
next if recipient_email.blank?
|
||||
next if recipient_email !~ /@/
|
||||
next if !recipient_email.match?(/@/)
|
||||
next if recipient_email.match?(/\s/)
|
||||
end
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ returns
|
|||
|
||||
def self.insert_urls(article)
|
||||
return article if article['attachments'].blank?
|
||||
return article if article['content_type'] !~ %r{text/html}i
|
||||
return article if !article['content_type'].match?(%r{text/html}i)
|
||||
return article if article['body'] !~ /<img/i
|
||||
|
||||
inline_attachments = {}
|
||||
|
|
|
@ -114,8 +114,8 @@ class Transaction::Notification
|
|||
already_notified = false
|
||||
History.list('Ticket', ticket.id).each do |history|
|
||||
next if history['type'] != 'notification'
|
||||
next if history['value_to'] !~ /\(#{Regexp.escape(@item[:type])}:/
|
||||
next if history['value_to'] !~ /#{Regexp.escape(identifier)}\(/
|
||||
next if !history['value_to'].match?(/\(#{Regexp.escape(@item[:type])}:/)
|
||||
next if !history['value_to'].match?(/#{Regexp.escape(identifier)}\(/)
|
||||
next if !history['created_at'].today?
|
||||
|
||||
already_notified = true
|
||||
|
|
|
@ -415,7 +415,7 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation
|
|||
next
|
||||
end
|
||||
raise "Can't import translation, format is missing" if row[2].blank?
|
||||
raise "Can't import translation, format is invalid (#{row[2]})" if row[2] !~ /^(time|string)$/
|
||||
raise "Can't import translation, format is invalid (#{row[2]})" if !row[2].match?(/^(time|string)$/)
|
||||
|
||||
item = {
|
||||
'locale' => locale.locale,
|
||||
|
|
|
@ -959,7 +959,7 @@ try to find correct name
|
|||
|
||||
self.email = email.downcase.strip
|
||||
return true if id == 1
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid email' if email !~ /@/
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid email' if !email.match?(/@/)
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid email' if email.match?(/\s/)
|
||||
|
||||
true
|
||||
|
@ -1182,7 +1182,7 @@ raise 'Minimum one user need to have admin permissions'
|
|||
def avatar_for_email_check
|
||||
return true if Setting.get('import_mode')
|
||||
return true if email.blank?
|
||||
return true if email !~ /@/
|
||||
return true if !email.match?(/@/)
|
||||
return true if !saved_change_to_attribute?('email') && updated_at > Time.zone.now - 10.days
|
||||
|
||||
# save/update avatar
|
||||
|
|
|
@ -71,7 +71,7 @@ returns on fail
|
|||
provider_map.each_value do |settings|
|
||||
domains.each do |domain_to_check|
|
||||
|
||||
next if domain_to_check !~ /#{settings[:domain]}/i
|
||||
next if !domain_to_check.match?(/#{settings[:domain]}/i)
|
||||
|
||||
# add folder to config if needed
|
||||
if params[:folder].present? && settings[:inbound] && settings[:inbound][:options]
|
||||
|
@ -339,7 +339,7 @@ returns on fail
|
|||
}
|
||||
white_map.each_key do |key|
|
||||
|
||||
next if e.message !~ /#{Regexp.escape(key)}/i
|
||||
next if !e.message.match?(/#{Regexp.escape(key)}/i)
|
||||
|
||||
return {
|
||||
result: 'ok',
|
||||
|
|
|
@ -168,7 +168,7 @@ satinize html string based on whiltelist
|
|||
next if !node[attribute_name]
|
||||
|
||||
href = cleanup_target(node[attribute_name])
|
||||
next if href !~ /(javascript|livescript|vbscript):/i
|
||||
next if !href.match?(/(javascript|livescript|vbscript):/i)
|
||||
|
||||
node.delete(attribute_name)
|
||||
end
|
||||
|
|
|
@ -141,7 +141,7 @@ or with filter:
|
|||
|
||||
def self._url_cleanup(url)
|
||||
url.strip!
|
||||
raise "Invalid endpoint '#{url}', need to start with http:// or https://" if url !~ %r{^http(s|)://}i
|
||||
raise "Invalid endpoint '#{url}', need to start with http:// or https://" if !url.match?(%r{^http(s|)://}i)
|
||||
|
||||
url = _url_cleanup_baseurl(url)
|
||||
url = "#{url}/src/jsonrpc.php"
|
||||
|
@ -150,7 +150,7 @@ or with filter:
|
|||
|
||||
def self._url_cleanup_baseurl(url)
|
||||
url.strip!
|
||||
raise "Invalid endpoint '#{url}', need to start with http:// or https://" if url !~ %r{^http(s|)://}i
|
||||
raise "Invalid endpoint '#{url}', need to start with http:// or https://" if !url.match?(%r{^http(s|)://}i)
|
||||
|
||||
url.gsub!(%r{src/jsonrpc.php}, '')
|
||||
url.gsub(%r{([^:])//+}, '\\1/')
|
||||
|
|
|
@ -160,7 +160,7 @@ module Import
|
|||
result.push 'Admin'
|
||||
end
|
||||
|
||||
return result if group['Name'] !~ /^(stats|report)/
|
||||
return result if !group['Name'].match?(/^(stats|report)/)
|
||||
return result if !( permissions.include?('ro') || permissions.include?('rw') )
|
||||
|
||||
result.push 'Report'
|
||||
|
|
|
@ -221,8 +221,8 @@ retunes
|
|||
result.each do |item|
|
||||
next if item['type'] != 'notification'
|
||||
next if item['object'] != 'Ticket'
|
||||
next if item['value_to'] !~ /#{recipient.email}/i
|
||||
next if item['value_to'] !~ /#{type}/i
|
||||
next if !item['value_to'].match?(/#{recipient.email}/i)
|
||||
next if !item['value_to'].match?(/#{type}/i)
|
||||
|
||||
count += 1
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ class Sequencer
|
|||
break if extractor.enough
|
||||
end
|
||||
rescue NoMethodError => e
|
||||
raise if e.message !~ /Viewpoint::EWS::/
|
||||
raise if !e.message.match?(/Viewpoint::EWS::/)
|
||||
|
||||
logger.error e
|
||||
logger.error "Skipping folder_id '#{folder_id}' due to unsupported entries."
|
||||
|
|
|
@ -440,7 +440,7 @@ returns
|
|||
files.push entry
|
||||
end
|
||||
files.sort.each do |entry|
|
||||
next if entry !~ /^send/
|
||||
next if !entry.match?(/^send/)
|
||||
|
||||
message = Sessions.queue_file_read(path, entry)
|
||||
next if !message
|
||||
|
|
|
@ -86,7 +86,7 @@ class Stats::TicketChannelDistribution
|
|||
}
|
||||
type_ids = []
|
||||
Ticket::Article::Type.all.each do |type|
|
||||
next if type.name !~ /^#{channel[:sender]}/i
|
||||
next if !type.name.match?(/^#{channel[:sender]}/i)
|
||||
|
||||
type_ids.push type.id
|
||||
end
|
||||
|
|
|
@ -289,8 +289,8 @@ end
|
|||
def es_pipeline?
|
||||
number = es_version
|
||||
return false if number.blank?
|
||||
return false if number =~ /^[2-4]\./
|
||||
return false if number =~ /^5\.[0-5]\./
|
||||
return false if number.match?(/^[2-4]\./)
|
||||
return false if number.match?(/^5\.[0-5]\./)
|
||||
|
||||
true
|
||||
end
|
||||
|
@ -299,7 +299,7 @@ end
|
|||
def es_multi_index?
|
||||
number = es_version
|
||||
return false if number.blank?
|
||||
return false if number =~ /^[2-5]\./
|
||||
return false if number.match?(/^[2-5]\./)
|
||||
|
||||
true
|
||||
end
|
||||
|
@ -308,7 +308,7 @@ end
|
|||
def es_type_in_mapping?
|
||||
number = es_version
|
||||
return true if number.blank?
|
||||
return true if number =~ /^[2-6]\./
|
||||
return true if number.match?(/^[2-6]\./)
|
||||
|
||||
false
|
||||
end
|
||||
|
|
|
@ -698,7 +698,7 @@ process webhook messages from twitter
|
|||
channel.options[:sync][:search].each do |local_search|
|
||||
next if local_search[:term].blank?
|
||||
next if local_search[:group_id].blank?
|
||||
next if item['text'] !~ /#{Regexp.quote(local_search[:term])}/i
|
||||
next if !item['text'].match?(/#{Regexp.quote(local_search[:term])}/i)
|
||||
|
||||
group_id = local_search[:group_id]
|
||||
break
|
||||
|
|
|
@ -1179,7 +1179,7 @@ set type of task (closeTab, closeNextInOverview, stayOnTab)
|
|||
cookies = instance.manage.all_cookies
|
||||
cookies.each do |cookie|
|
||||
# :name=>"_zammad_session_c25832f4de2", :value=>"adc31cd21615cb0a7ab269184ec8b76f", :path=>"/", :domain=>"localhost", :expires=>nil, :secure=>false}
|
||||
next if cookie[:name] !~ /#{params[:name]}/i
|
||||
next if !cookie[:name].match?(/#{params[:name]}/i)
|
||||
|
||||
if params.key?(:value) && cookie[:value].to_s =~ /#{params[:value]}/i
|
||||
assert(true, "matching value '#{params[:value]}' in cookie '#{cookie}'")
|
||||
|
|
|
@ -66,8 +66,8 @@ class ActiveSupport::TestCase
|
|||
count = 0
|
||||
lines.reverse_each do |line|
|
||||
break if line.match?(/\+\+\+\+NEW\+\+\+\+TEST\+\+\+\+/)
|
||||
next if line !~ /Send notification \(#{type}\)/
|
||||
next if line !~ /to:\s#{recipient}/
|
||||
next if !line.match?(/Send notification \(#{type}\)/)
|
||||
next if !line.match?(/to:\s#{recipient}/)
|
||||
|
||||
count += 1
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue