Updated rubocop(-* gems) to latest version (0.84.0).
This commit is contained in:
parent
e037b6015e
commit
8690916936
17 changed files with 29 additions and 26 deletions
|
@ -448,14 +448,17 @@ GEM
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.8.0)
|
||||||
rspec-support (3.8.0)
|
rspec-support (3.8.0)
|
||||||
rszr (0.5.2)
|
rszr (0.5.2)
|
||||||
rubocop (0.83.0)
|
rubocop (0.84.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.7.0.1)
|
parser (>= 2.7.0.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
rexml
|
rexml
|
||||||
|
rubocop-ast (>= 0.0.3)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 2.0)
|
unicode-display_width (>= 1.4.0, < 2.0)
|
||||||
rubocop-performance (1.5.2)
|
rubocop-ast (0.0.3)
|
||||||
|
parser (>= 2.7.0.1)
|
||||||
|
rubocop-performance (1.6.0)
|
||||||
rubocop (>= 0.71.0)
|
rubocop (>= 0.71.0)
|
||||||
rubocop-rails (2.5.2)
|
rubocop-rails (2.5.2)
|
||||||
activesupport
|
activesupport
|
||||||
|
|
|
@ -638,8 +638,8 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
||||||
|
|
||||||
# cleanup content id, <> will be added automatically later
|
# cleanup content id, <> will be added automatically later
|
||||||
if headers_store['Content-ID']
|
if headers_store['Content-ID']
|
||||||
headers_store['Content-ID'].gsub!(/^</, '')
|
headers_store['Content-ID'].delete_prefix!('<')
|
||||||
headers_store['Content-ID'].gsub!(/>$/, '')
|
headers_store['Content-ID'].delete_suffix!('>')
|
||||||
end
|
end
|
||||||
|
|
||||||
# get filename from content-disposition
|
# get filename from content-disposition
|
||||||
|
|
|
@ -188,8 +188,8 @@ module Channel::Filter::IdentifySender
|
||||||
|
|
||||||
string.strip
|
string.strip
|
||||||
.delete('"')
|
.delete('"')
|
||||||
.gsub(/^'/, '')
|
.delete_prefix("'")
|
||||||
.gsub(/'$/, '')
|
.delete_suffix("'")
|
||||||
.gsub(/.+?\s\(.+?\)$/, '')
|
.gsub(/.+?\s\(.+?\)$/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ module Channel::Filter::IdentifySender
|
||||||
.sub(/^<|>$/, '') # see https://github.com/zammad/zammad/issues/2254
|
.sub(/^<|>$/, '') # see https://github.com/zammad/zammad/issues/2254
|
||||||
.sub(/\A'(.*)'\z/, '\1') # see https://github.com/zammad/zammad/issues/2154
|
.sub(/\A'(.*)'\z/, '\1') # see https://github.com/zammad/zammad/issues/2154
|
||||||
.gsub(/\s/, '') # see https://github.com/zammad/zammad/issues/2198
|
.gsub(/\s/, '') # see https://github.com/zammad/zammad/issues/2198
|
||||||
.gsub(/\.\z/, '')
|
.delete_suffix('.')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -247,8 +247,8 @@ returns
|
||||||
next if value.class == ActiveSupport::HashWithIndifferentAccess
|
next if value.class == ActiveSupport::HashWithIndifferentAccess
|
||||||
next if value.class == Hash
|
next if value.class == Hash
|
||||||
next if csv_attributes_ignored&.include?(key.to_sym)
|
next if csv_attributes_ignored&.include?(key.to_sym)
|
||||||
next if key.match?(/_id$/)
|
next if key.end_with?('_id')
|
||||||
next if key.match?(/_ids$/)
|
next if key.end_with?('_ids')
|
||||||
next if key == 'created_by'
|
next if key == 'created_by'
|
||||||
next if key == 'updated_by'
|
next if key == 'updated_by'
|
||||||
next if key == 'created_at'
|
next if key == 'created_at'
|
||||||
|
|
|
@ -54,7 +54,7 @@ class KnowledgeBase < ApplicationModel
|
||||||
|
|
||||||
data[:KnowledgeBase].each do |_, elem|
|
data[:KnowledgeBase].each do |_, elem|
|
||||||
elem.delete_if do |k, _|
|
elem.delete_if do |k, _|
|
||||||
k.match?(/_ids$/)
|
k.end_with?('_ids')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ link files + execute migration up
|
||||||
file = file.sub(%r{^/}, '')
|
file = file.sub(%r{^/}, '')
|
||||||
|
|
||||||
# ignore files
|
# ignore files
|
||||||
if file.match?(/^README/)
|
if file.start_with?('README')
|
||||||
logger.info "NOTICE: Ignore #{file}"
|
logger.info "NOTICE: Ignore #{file}"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Package::Migration < ApplicationModel
|
||||||
end
|
end
|
||||||
|
|
||||||
migrations_existing.each do |migration|
|
migrations_existing.each do |migration|
|
||||||
next if !migration.match?(/\.rb$/)
|
next if !migration.end_with?('.rb')
|
||||||
|
|
||||||
version = nil
|
version = nil
|
||||||
name = nil
|
name = nil
|
||||||
|
|
|
@ -582,7 +582,7 @@ condition example
|
||||||
# validate value / allow blank but only if pre_condition exists and is not specific
|
# validate value / allow blank but only if pre_condition exists and is not specific
|
||||||
if !selector.key?('value') ||
|
if !selector.key?('value') ||
|
||||||
(selector['value'].class == Array && selector['value'].respond_to?(:blank?) && selector['value'].blank?) ||
|
(selector['value'].class == Array && selector['value'].respond_to?(:blank?) && selector['value'].blank?) ||
|
||||||
(selector['operator'] =~ /^contains/ && selector['value'].respond_to?(:blank?) && selector['value'].blank?)
|
(selector['operator'].start_with?('contains') && selector['value'].respond_to?(:blank?) && selector['value'].blank?)
|
||||||
return nil if selector['pre_condition'].nil?
|
return nil if selector['pre_condition'].nil?
|
||||||
return nil if selector['pre_condition'].respond_to?(:blank?) && selector['pre_condition'].blank?
|
return nil if selector['pre_condition'].respond_to?(:blank?) && selector['pre_condition'].blank?
|
||||||
return nil if selector['pre_condition'] == 'specific'
|
return nil if selector['pre_condition'] == 'specific'
|
||||||
|
@ -938,9 +938,9 @@ perform changes on ticket
|
||||||
|
|
||||||
# lookup pre_condition
|
# lookup pre_condition
|
||||||
if value['pre_condition']
|
if value['pre_condition']
|
||||||
if value['pre_condition'].match?(/^not_set/)
|
if value['pre_condition'].start_with?('not_set')
|
||||||
value['value'] = 1
|
value['value'] = 1
|
||||||
elsif value['pre_condition'].match?(/^current_user\./)
|
elsif value['pre_condition'].start_with?('current_user.')
|
||||||
raise 'Unable to use current_user, got no current_user_id for ticket.perform_changes' if !current_user_id
|
raise 'Unable to use current_user, got no current_user_id for ticket.perform_changes' if !current_user_id
|
||||||
|
|
||||||
value['value'] = current_user_id
|
value['value'] = current_user_id
|
||||||
|
|
|
@ -422,7 +422,7 @@ returns
|
||||||
def permissions?(key)
|
def permissions?(key)
|
||||||
Array(key).each do |local_key|
|
Array(key).each do |local_key|
|
||||||
list = []
|
list = []
|
||||||
if local_key.match?(/\.\*$/)
|
if local_key.end_with?('.*')
|
||||||
local_key = local_key.sub('.*', '.%')
|
local_key = local_key.sub('.*', '.%')
|
||||||
permissions = ::Permission.with_parents(local_key)
|
permissions = ::Permission.with_parents(local_key)
|
||||||
list = ::Permission.select('preferences').joins(:roles).where('roles.id IN (?) AND roles.active = ? AND (permissions.name IN (?) OR permissions.name LIKE ?) AND permissions.active = ?', role_ids, true, permissions, local_key, true).pluck(:preferences)
|
list = ::Permission.select('preferences').joins(:roles).where('roles.id IN (?) AND roles.active = ? AND (permissions.name IN (?) OR permissions.name LIKE ?) AND permissions.active = ?', role_ids, true, permissions, local_key, true).pluck(:preferences)
|
||||||
|
|
|
@ -13,7 +13,7 @@ module ActiveRecord
|
||||||
if column_names.class == Array
|
if column_names.class == Array
|
||||||
index_columns_new = []
|
index_columns_new = []
|
||||||
column_names.each do |i|
|
column_names.each do |i|
|
||||||
if i =~ /^"(name|login|locale|alias)"$/ || i =~ /name"$/
|
if i =~ /^"(name|login|locale|alias)"$/ || i.end_with?('name"')
|
||||||
index_columns_new.push "LOWER(#{i})"
|
index_columns_new.push "LOWER(#{i})"
|
||||||
else
|
else
|
||||||
index_columns_new.push i
|
index_columns_new.push i
|
||||||
|
|
|
@ -78,7 +78,7 @@ class String
|
||||||
|
|
||||||
def to_classname
|
def to_classname
|
||||||
camel_cased_word = dup
|
camel_cased_word = dup
|
||||||
camel_cased_word.gsub!(/\.rb$/, '')
|
camel_cased_word.delete_suffix!('.rb')
|
||||||
camel_cased_word.split('/').map(&:camelize).join('::')
|
camel_cased_word.split('/').map(&:camelize).join('::')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -421,8 +421,8 @@ cleanup html string:
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.url_same?(url_new, url_old)
|
def self.url_same?(url_new, url_old)
|
||||||
url_new = CGI.unescape(url_new.to_s).utf8_encode(fallback: :read_as_sanitized_binary).downcase.gsub(%r{/$}, '').gsub(/[[:space:]]|\t|\n|\r/, '').strip
|
url_new = CGI.unescape(url_new.to_s).utf8_encode(fallback: :read_as_sanitized_binary).downcase.delete_suffix('/').gsub(/[[:space:]]|\t|\n|\r/, '').strip
|
||||||
url_old = CGI.unescape(url_old.to_s).utf8_encode(fallback: :read_as_sanitized_binary).downcase.gsub(%r{/$}, '').gsub(/[[:space:]]|\t|\n|\r/, '').strip
|
url_old = CGI.unescape(url_old.to_s).utf8_encode(fallback: :read_as_sanitized_binary).downcase.delete_suffix('/').gsub(/[[:space:]]|\t|\n|\r/, '').strip
|
||||||
url_new = html_decode(url_new).sub('/?', '?')
|
url_new = html_decode(url_new).sub('/?', '?')
|
||||||
url_old = html_decode(url_old).sub('/?', '?')
|
url_old = html_decode(url_old).sub('/?', '?')
|
||||||
return true if url_new == url_old
|
return true if url_new == url_old
|
||||||
|
|
|
@ -440,7 +440,7 @@ returns
|
||||||
files.push entry
|
files.push entry
|
||||||
end
|
end
|
||||||
files.sort.each do |entry|
|
files.sort.each do |entry|
|
||||||
next if !entry.match?(/^send/)
|
next if !entry.start_with?('send')
|
||||||
|
|
||||||
message = Sessions.queue_file_read(path, entry)
|
message = Sessions.queue_file_read(path, entry)
|
||||||
next if !message
|
next if !message
|
||||||
|
|
|
@ -721,12 +721,12 @@ returns
|
||||||
|
|
||||||
# send welcome message and don't create ticket
|
# send welcome message and don't create ticket
|
||||||
text = params[:message][:text]
|
text = params[:message][:text]
|
||||||
if text.present? && text =~ %r{^/start}
|
if text.present? && text.start_with?('/start')
|
||||||
message(params[:message][:chat][:id], channel.options[:welcome] || 'You are welcome! Just ask me something!', params[:message][:from][:language_code])
|
message(params[:message][:chat][:id], channel.options[:welcome] || 'You are welcome! Just ask me something!', params[:message][:from][:language_code])
|
||||||
return
|
return
|
||||||
|
|
||||||
# find ticket and close it
|
# find ticket and close it
|
||||||
elsif text.present? && text =~ %r{^/end}
|
elsif text.present? && text.start_with?('/end')
|
||||||
user = to_user(params)
|
user = to_user(params)
|
||||||
|
|
||||||
# get the last ticket of customer which is not closed yet, and close it
|
# get the last ticket of customer which is not closed yet, and close it
|
||||||
|
|
|
@ -42,7 +42,7 @@ module Zammad
|
||||||
MSG
|
MSG
|
||||||
end
|
end
|
||||||
# Setting.get will fail if 'settings' table does not exist
|
# Setting.get will fail if 'settings' table does not exist
|
||||||
rescue ActiveRecord::StatementInvalid # rubocop:disable Lint/SuppressedException
|
rescue ActiveRecord::StatementInvalid
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.connection
|
def self.connection
|
||||||
|
|
|
@ -71,7 +71,7 @@ module BrowserTestHelper
|
||||||
self.until do
|
self.until do
|
||||||
|
|
||||||
yield
|
yield
|
||||||
rescue Capybara::ElementNotFound # rubocop:disable Lint/SuppressedException
|
rescue Capybara::ElementNotFound
|
||||||
|
|
||||||
end
|
end
|
||||||
rescue Selenium::WebDriver::Error::TimeOutError => e
|
rescue Selenium::WebDriver::Error::TimeOutError => e
|
||||||
|
|
|
@ -6,7 +6,7 @@ class EmailBuildTest < ActiveSupport::TestCase
|
||||||
html = '<b>test</b>'
|
html = '<b>test</b>'
|
||||||
result = Channel::EmailBuild.html_complete_check(html)
|
result = Channel::EmailBuild.html_complete_check(html)
|
||||||
|
|
||||||
assert(result =~ /^<\!DOCTYPE/, 'test 1')
|
assert(result.start_with?('<!DOCTYPE'), 'test 1')
|
||||||
assert(result !~ /^.+?<\!DOCTYPE/, 'test 1')
|
assert(result !~ /^.+?<\!DOCTYPE/, 'test 1')
|
||||||
assert(result =~ /<html>/, 'test 1')
|
assert(result =~ /<html>/, 'test 1')
|
||||||
assert(result =~ /font-family/, 'test 1')
|
assert(result =~ /font-family/, 'test 1')
|
||||||
|
|
Loading…
Reference in a new issue