Updated rubocop(-* gems) to latest version (0.85.1).
This commit is contained in:
parent
90f1442dc8
commit
72bb320fb0
19 changed files with 42 additions and 45 deletions
21
Gemfile.lock
21
Gemfile.lock
|
@ -122,7 +122,7 @@ GEM
|
||||||
buftok (0.2.0)
|
buftok (0.2.0)
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
byebug (11.0.1)
|
byebug (11.0.1)
|
||||||
capybara (3.21.0)
|
capybara (3.32.2)
|
||||||
addressable
|
addressable
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
|
@ -247,7 +247,7 @@ GEM
|
||||||
http-form_data (2.1.1)
|
http-form_data (2.1.1)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
httpclient (2.8.3)
|
httpclient (2.8.3)
|
||||||
i18n (1.8.2)
|
i18n (1.8.3)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
icalendar (2.5.3)
|
icalendar (2.5.3)
|
||||||
ice_cube (~> 0.16)
|
ice_cube (~> 0.16)
|
||||||
|
@ -357,7 +357,7 @@ GEM
|
||||||
omniauth-oauth2 (>= 1.4.0)
|
omniauth-oauth2 (>= 1.4.0)
|
||||||
openssl (2.1.2)
|
openssl (2.1.2)
|
||||||
parallel (1.19.1)
|
parallel (1.19.1)
|
||||||
parser (2.7.1.2)
|
parser (2.7.1.3)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
pg (0.21.0)
|
pg (0.21.0)
|
||||||
pluginator (1.5.0)
|
pluginator (1.5.0)
|
||||||
|
@ -378,7 +378,7 @@ GEM
|
||||||
pry-stack_explorer (0.4.9.3)
|
pry-stack_explorer (0.4.9.3)
|
||||||
binding_of_caller (>= 0.7)
|
binding_of_caller (>= 0.7)
|
||||||
pry (>= 0.9.11)
|
pry (>= 0.9.11)
|
||||||
public_suffix (3.0.3)
|
public_suffix (3.1.1)
|
||||||
puma (3.12.6)
|
puma (3.12.6)
|
||||||
pundit (2.0.1)
|
pundit (2.0.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
@ -426,7 +426,7 @@ GEM
|
||||||
rb-inotify (0.10.0)
|
rb-inotify (0.10.0)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
rchardet (1.8.0)
|
rchardet (1.8.0)
|
||||||
regexp_parser (1.5.1)
|
regexp_parser (1.7.1)
|
||||||
rest-client (2.0.2)
|
rest-client (2.0.2)
|
||||||
http-cookie (>= 1.0.2, < 2.0)
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
mime-types (>= 1.16, < 4.0)
|
mime-types (>= 1.16, < 4.0)
|
||||||
|
@ -451,22 +451,23 @@ 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.84.0)
|
rubocop (0.85.1)
|
||||||
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)
|
||||||
|
regexp_parser (>= 1.7)
|
||||||
rexml
|
rexml
|
||||||
rubocop-ast (>= 0.0.3)
|
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-ast (0.0.3)
|
rubocop-ast (0.0.3)
|
||||||
parser (>= 2.7.0.1)
|
parser (>= 2.7.0.1)
|
||||||
rubocop-performance (1.6.0)
|
rubocop-performance (1.6.1)
|
||||||
rubocop (>= 0.71.0)
|
rubocop (>= 0.71.0)
|
||||||
rubocop-rails (2.5.2)
|
rubocop-rails (2.6.0)
|
||||||
activesupport
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 0.72.0)
|
rubocop (>= 0.82.0)
|
||||||
rubocop-rspec (1.39.0)
|
rubocop-rspec (1.39.0)
|
||||||
rubocop (>= 0.68.1)
|
rubocop (>= 0.68.1)
|
||||||
ruby-progressbar (1.10.1)
|
ruby-progressbar (1.10.1)
|
||||||
|
|
|
@ -11,7 +11,7 @@ module KnowledgeBaseHelper
|
||||||
custom_address = knowledge_base.custom_address_uri
|
custom_address = knowledge_base.custom_address_uri
|
||||||
return path unless custom_address
|
return path unless custom_address
|
||||||
|
|
||||||
output = path.gsub(%r{^\/help}, custom_address.path || '').presence || '/'
|
output = path.gsub(%r{^/help}, custom_address.path || '').presence || '/'
|
||||||
|
|
||||||
if full
|
if full
|
||||||
fqdn = request.headers.env['SERVER_NAME']
|
fqdn = request.headers.env['SERVER_NAME']
|
||||||
|
|
|
@ -28,7 +28,7 @@ module KnowledgeBaseRichTextHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_rich_text_videos(input)
|
def prepare_rich_text_videos(input)
|
||||||
input.gsub(/\(([\s]*)widget:([\s]*)video[\W]([\s\S])+?\)/) do |match|
|
input.gsub(/\((\s*)widget:(\s*)video\W([\s\S])+?\)/) do |match|
|
||||||
settings = match
|
settings = match
|
||||||
.slice(1...-1)
|
.slice(1...-1)
|
||||||
.split(',')
|
.split(',')
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Channel::Filter::MonitoringBase
|
||||||
|
|
||||||
# icinga - get state by body - new templates
|
# icinga - get state by body - new templates
|
||||||
if result['state'].blank?
|
if result['state'].blank?
|
||||||
if mail[:body] =~ /.+?\sis\s(.+?)\!/
|
if mail[:body] =~ /.+?\sis\s(.+?)!/
|
||||||
result['state'] = $1
|
result['state'] = $1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -57,7 +57,7 @@ class Channel::Filter::MonitoringBase
|
||||||
# Subject: [PROBLEM] Ping IPv4 on host1234.dc.example.com is WARNING!
|
# Subject: [PROBLEM] Ping IPv4 on host1234.dc.example.com is WARNING!
|
||||||
# Subject: [PROBLEM] Host host1234.dc.example.com is DOWN!
|
# Subject: [PROBLEM] Host host1234.dc.example.com is DOWN!
|
||||||
if result['state'].blank?
|
if result['state'].blank?
|
||||||
if mail[:subject] =~ /(on|Host)\s.+?\sis\s(.+?)\!/
|
if mail[:subject] =~ /(on|Host)\s.+?\sis\s(.+?)!/
|
||||||
result['state'] = $2
|
result['state'] = $2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -226,7 +226,7 @@ returns
|
||||||
# see specs for example
|
# see specs for example
|
||||||
return [] if !text.is_a?(String)
|
return [] if !text.is_a?(String)
|
||||||
|
|
||||||
text.scan(/([\d|\s|\-|\(|\)]{6,26})/).map do |match|
|
text.scan(/([\d|\s|\-|(|)]{6,26})/).map do |match|
|
||||||
normalize_number(match[0])
|
normalize_number(match[0])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,21 +9,19 @@ class KnowledgeBase::Category < ApplicationModel
|
||||||
|
|
||||||
belongs_to :knowledge_base, inverse_of: :categories
|
belongs_to :knowledge_base, inverse_of: :categories
|
||||||
|
|
||||||
has_many :answers, class_name: 'KnowledgeBase::Answer',
|
has_many :answers, class_name: 'KnowledgeBase::Answer',
|
||||||
foreign_key: :category_id,
|
inverse_of: :category,
|
||||||
inverse_of: :category,
|
dependent: :restrict_with_exception
|
||||||
dependent: :restrict_with_exception
|
|
||||||
|
|
||||||
has_many :children, class_name: 'KnowledgeBase::Category',
|
has_many :children, class_name: 'KnowledgeBase::Category',
|
||||||
foreign_key: :parent_id,
|
foreign_key: :parent_id,
|
||||||
inverse_of: :parent,
|
inverse_of: :parent,
|
||||||
dependent: :restrict_with_exception
|
dependent: :restrict_with_exception
|
||||||
|
|
||||||
belongs_to :parent, class_name: 'KnowledgeBase::Category',
|
belongs_to :parent, class_name: 'KnowledgeBase::Category',
|
||||||
foreign_key: :parent_id,
|
inverse_of: :children,
|
||||||
inverse_of: :children,
|
touch: true,
|
||||||
touch: true,
|
optional: true
|
||||||
optional: true
|
|
||||||
|
|
||||||
validates :category_icon, presence: true
|
validates :category_icon, presence: true
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class KnowledgeBase::MenuItem < ApplicationModel
|
||||||
|
|
||||||
url.strip!
|
url.strip!
|
||||||
|
|
||||||
return if url.match? %r{^\S+\:\/\/}
|
return if url.match? %r{^\S+://}
|
||||||
return if url[0] == '/'
|
return if url[0] == '/'
|
||||||
|
|
||||||
self.url = "http://#{url}"
|
self.url = "http://#{url}"
|
||||||
|
|
|
@ -3,11 +3,8 @@
|
||||||
class StatsStore < ApplicationModel
|
class StatsStore < ApplicationModel
|
||||||
include HasSearchIndexBackend
|
include HasSearchIndexBackend
|
||||||
include StatsStore::SearchIndex
|
include StatsStore::SearchIndex
|
||||||
|
belongs_to :stats_store_object, class_name: 'ObjectLookup', optional: true
|
||||||
# rubocop:disable Rails/InverseOf
|
belongs_to :related_stats_store_object, class_name: 'ObjectLookup', optional: true
|
||||||
belongs_to :stats_store_object, class_name: 'ObjectLookup', foreign_key: 'stats_store_object_id', optional: true
|
|
||||||
belongs_to :related_stats_store_object, class_name: 'ObjectLookup', foreign_key: 'related_stats_store_object_id', optional: true
|
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
store :data
|
store :data
|
||||||
|
|
||||||
|
|
|
@ -892,7 +892,7 @@ try to find correct name
|
||||||
|
|
||||||
# -no name- "firstname.lastname@example.com"
|
# -no name- "firstname.lastname@example.com"
|
||||||
if string.blank? && email.present?
|
if string.blank? && email.present?
|
||||||
scan = email.scan(/^(.+?)\.(.+?)\@.+?$/)
|
scan = email.scan(/^(.+?)\.(.+?)@.+?$/)
|
||||||
if scan[0].present?
|
if scan[0].present?
|
||||||
if scan[0][0].present?
|
if scan[0][0].present?
|
||||||
firstname = scan[0][0].strip
|
firstname = scan[0][0].strip
|
||||||
|
|
|
@ -8,7 +8,7 @@ if Kernel.respond_to?(:open_uri_original_open)
|
||||||
if name.respond_to?(:open) && name.method(:open).parameters.present?
|
if name.respond_to?(:open) && name.method(:open).parameters.present?
|
||||||
name.open(*rest, &block)
|
name.open(*rest, &block)
|
||||||
elsif name.respond_to?(:to_str) &&
|
elsif name.respond_to?(:to_str) &&
|
||||||
%r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ name &&
|
%r{\A[A-Za-z][A-Za-z0-9+\-.]*://} =~ name &&
|
||||||
(uri = URI.parse(name)).respond_to?(:open)
|
(uri = URI.parse(name)).respond_to?(:open)
|
||||||
uri.open(*rest, &block)
|
uri.open(*rest, &block)
|
||||||
else
|
else
|
||||||
|
|
|
@ -137,7 +137,7 @@ class String
|
||||||
string.gsub!(%r{<a[[:space:]]+(|\S+[[:space:]]+)href=("|')(.+?)("|')([[:space:]]*|[[:space:]]+[^>]*)>(.+?)<[[:space:]]*/a[[:space:]]*>}mxi) do |_placeholder|
|
string.gsub!(%r{<a[[:space:]]+(|\S+[[:space:]]+)href=("|')(.+?)("|')([[:space:]]*|[[:space:]]+[^>]*)>(.+?)<[[:space:]]*/a[[:space:]]*>}mxi) do |_placeholder|
|
||||||
link = $3
|
link = $3
|
||||||
text = $6
|
text = $6
|
||||||
text.gsub!(/\<.+?\>/, '')
|
text.gsub!(/<.+?>/, '')
|
||||||
|
|
||||||
link_compare = link.dup
|
link_compare = link.dup
|
||||||
if link_compare.present?
|
if link_compare.present?
|
||||||
|
@ -218,7 +218,7 @@ class String
|
||||||
string.gsub!(%r{</td>}i, ' ')
|
string.gsub!(%r{</td>}i, ' ')
|
||||||
|
|
||||||
# strip all other tags
|
# strip all other tags
|
||||||
string.gsub!(/\<.+?\>/, '')
|
string.gsub!(/<.+?>/, '')
|
||||||
|
|
||||||
# replace multiple spaces with one
|
# replace multiple spaces with one
|
||||||
string.gsub!(/ /, ' ')
|
string.gsub!(/ /, ' ')
|
||||||
|
@ -348,8 +348,8 @@ class String
|
||||||
string.gsub!(/(<br>[[:space:]]*){3,}/im, '<br><br>')
|
string.gsub!(/(<br>[[:space:]]*){3,}/im, '<br><br>')
|
||||||
string.gsub!(%r\(<br(|/)>[[:space:]]*){3,}\im, '<br/><br/>')
|
string.gsub!(%r\(<br(|/)>[[:space:]]*){3,}\im, '<br/><br/>')
|
||||||
string.gsub!(%r{<p>[[:space:]]+</p>}im, '<p> </p>')
|
string.gsub!(%r{<p>[[:space:]]+</p>}im, '<p> </p>')
|
||||||
string.gsub!(%r{\A(<br(|\/)>[[:space:]]*)*}i, '')
|
string.gsub!(%r{\A(<br(|/)>[[:space:]]*)*}i, '')
|
||||||
string.gsub!(%r{[[:space:]]*(<br(|\/)>[[:space:]]*)*\Z}i, '')
|
string.gsub!(%r{[[:space:]]*(<br(|/)>[[:space:]]*)*\Z}i, '')
|
||||||
string.gsub!(%r{(<p></p>){1,10}\Z}i, '')
|
string.gsub!(%r{(<p></p>){1,10}\Z}i, '')
|
||||||
|
|
||||||
string.signature_identify('html')
|
string.signature_identify('html')
|
||||||
|
|
|
@ -124,7 +124,7 @@ or with filter:
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
raise "Can't fetch objects from #{url}: Unable to parse response from server. Invalid JSON response." if !result.success? && result.error =~ /JSON::ParserError:.+?\s+unexpected\s+token\s+at\s+'<\!DOCTYPE\s+html/i
|
raise "Can't fetch objects from #{url}: Unable to parse response from server. Invalid JSON response." if !result.success? && result.error =~ /JSON::ParserError:.+?\s+unexpected\s+token\s+at\s+'<!DOCTYPE\s+html/i
|
||||||
raise "Can't fetch objects from #{url}: #{result.error}" if !result.success?
|
raise "Can't fetch objects from #{url}: #{result.error}" if !result.success?
|
||||||
|
|
||||||
# add link to idoit
|
# add link to idoit
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Import
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.convert_name(dynamic_field_name)
|
def self.convert_name(dynamic_field_name)
|
||||||
dynamic_field_name.underscore.sub(/\_id(s)?\z/, '_no\1')
|
dynamic_field_name.underscore.sub(/_id(s)?\z/, '_no\1')
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Ldap
|
||||||
#
|
#
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def self.valid?(string)
|
def self.valid?(string)
|
||||||
string.match?(/\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w+/)
|
string.match?(/\w{8}-\w{4}-\w{4}-\w{4}-\w+/)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Convers a given GUID string into the HEX equivalent.
|
# Convers a given GUID string into the HEX equivalent.
|
||||||
|
|
|
@ -105,7 +105,7 @@ examples how to use
|
||||||
end
|
end
|
||||||
|
|
||||||
arguments = nil
|
arguments = nil
|
||||||
if /\A(?<method_id>[^\(]+)\((?<parameter>[^\)]+)\)\z/ =~ method
|
if /\A(?<method_id>[^(]+)\((?<parameter>[^)]+)\)\z/ =~ method
|
||||||
|
|
||||||
if parameter != parameter.to_i.to_s
|
if parameter != parameter.to_i.to_s
|
||||||
value = "\#{#{object_name}.#{object_methods_s} / invalid parameter: #{parameter}}"
|
value = "\#{#{object_name}.#{object_methods_s} / invalid parameter: #{parameter}}"
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Sequencer
|
||||||
# model___name
|
# model___name
|
||||||
# model_name
|
# model_name
|
||||||
# model_name
|
# model_name
|
||||||
transliterated.gsub(%r{[\s\/]}, '_').underscore
|
transliterated.gsub(%r{[\s/]}, '_').underscore
|
||||||
end
|
end
|
||||||
|
|
||||||
def transliterated
|
def transliterated
|
||||||
|
|
|
@ -41,8 +41,8 @@ module Zammad
|
||||||
Please increase this value in your #{vendor} configuration accordingly.
|
Please increase this value in your #{vendor} configuration accordingly.
|
||||||
MSG
|
MSG
|
||||||
end
|
end
|
||||||
# Setting.get will fail if 'settings' table does not exist
|
|
||||||
rescue ActiveRecord::StatementInvalid
|
rescue ActiveRecord::StatementInvalid
|
||||||
|
# Setting.get will fail if 'settings' table does not exist
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.connection
|
def self.connection
|
||||||
|
|
|
@ -86,6 +86,7 @@ module BrowserTestHelper
|
||||||
|
|
||||||
yield
|
yield
|
||||||
rescue Capybara::ElementNotFound
|
rescue Capybara::ElementNotFound
|
||||||
|
# doesn't exist yet
|
||||||
end
|
end
|
||||||
rescue Selenium::WebDriver::Error::TimeOutError => e
|
rescue Selenium::WebDriver::Error::TimeOutError => e
|
||||||
# cleanup backtrace
|
# cleanup backtrace
|
||||||
|
|
|
@ -7,7 +7,7 @@ class EmailBuildTest < ActiveSupport::TestCase
|
||||||
result = Channel::EmailBuild.html_complete_check(html)
|
result = Channel::EmailBuild.html_complete_check(html)
|
||||||
|
|
||||||
assert(result.start_with?('<!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')
|
||||||
assert(result =~ %r{<b>test</b>}, 'test 1')
|
assert(result =~ %r{<b>test</b>}, 'test 1')
|
||||||
|
@ -15,8 +15,8 @@ class EmailBuildTest < ActiveSupport::TestCase
|
||||||
html = 'invalid <!DOCTYPE html><html><b>test</b></html>'
|
html = 'invalid <!DOCTYPE html><html><b>test</b></html>'
|
||||||
result = Channel::EmailBuild.html_complete_check(html)
|
result = Channel::EmailBuild.html_complete_check(html)
|
||||||
|
|
||||||
assert(result !~ /^<\!DOCTYPE/, 'test 2')
|
assert(result !~ /^<!DOCTYPE/, 'test 2')
|
||||||
assert(result =~ /^.+?<\!DOCTYPE/, 'test 2')
|
assert(result =~ /^.+?<!DOCTYPE/, 'test 2')
|
||||||
assert(result =~ /<html>/, 'test 2')
|
assert(result =~ /<html>/, 'test 2')
|
||||||
assert(result !~ /font-family/, 'test 2')
|
assert(result !~ /font-family/, 'test 2')
|
||||||
assert(result =~ %r{<b>test</b>}, 'test 2')
|
assert(result =~ %r{<b>test</b>}, 'test 2')
|
||||||
|
|
Loading…
Reference in a new issue