Updated rubocop(-* gems) to latest version (0.85.1).

This commit is contained in:
Thorsten Eckel 2020-06-08 09:17:29 +02:00
parent 90f1442dc8
commit 72bb320fb0
19 changed files with 42 additions and 45 deletions

View file

@ -122,7 +122,7 @@ GEM
buftok (0.2.0)
builder (3.2.4)
byebug (11.0.1)
capybara (3.21.0)
capybara (3.32.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
@ -247,7 +247,7 @@ GEM
http-form_data (2.1.1)
http_parser.rb (0.6.0)
httpclient (2.8.3)
i18n (1.8.2)
i18n (1.8.3)
concurrent-ruby (~> 1.0)
icalendar (2.5.3)
ice_cube (~> 0.16)
@ -357,7 +357,7 @@ GEM
omniauth-oauth2 (>= 1.4.0)
openssl (2.1.2)
parallel (1.19.1)
parser (2.7.1.2)
parser (2.7.1.3)
ast (~> 2.4.0)
pg (0.21.0)
pluginator (1.5.0)
@ -378,7 +378,7 @@ GEM
pry-stack_explorer (0.4.9.3)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
public_suffix (3.0.3)
public_suffix (3.1.1)
puma (3.12.6)
pundit (2.0.1)
activesupport (>= 3.0.0)
@ -426,7 +426,7 @@ GEM
rb-inotify (0.10.0)
ffi (~> 1.0)
rchardet (1.8.0)
regexp_parser (1.5.1)
regexp_parser (1.7.1)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
@ -451,22 +451,23 @@ GEM
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rszr (0.5.2)
rubocop (0.84.0)
rubocop (0.85.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.0.3)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.0.3)
parser (>= 2.7.0.1)
rubocop-performance (1.6.0)
rubocop-performance (1.6.1)
rubocop (>= 0.71.0)
rubocop-rails (2.5.2)
activesupport
rubocop-rails (2.6.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.72.0)
rubocop (>= 0.82.0)
rubocop-rspec (1.39.0)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)

View file

@ -11,7 +11,7 @@ module KnowledgeBaseHelper
custom_address = knowledge_base.custom_address_uri
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
fqdn = request.headers.env['SERVER_NAME']

View file

@ -28,7 +28,7 @@ module KnowledgeBaseRichTextHelper
end
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
.slice(1...-1)
.split(',')

View file

@ -48,7 +48,7 @@ class Channel::Filter::MonitoringBase
# icinga - get state by body - new templates
if result['state'].blank?
if mail[:body] =~ /.+?\sis\s(.+?)\!/
if mail[:body] =~ /.+?\sis\s(.+?)!/
result['state'] = $1
end
end
@ -57,7 +57,7 @@ class Channel::Filter::MonitoringBase
# Subject: [PROBLEM] Ping IPv4 on host1234.dc.example.com is WARNING!
# Subject: [PROBLEM] Host host1234.dc.example.com is DOWN!
if result['state'].blank?
if mail[:subject] =~ /(on|Host)\s.+?\sis\s(.+?)\!/
if mail[:subject] =~ /(on|Host)\s.+?\sis\s(.+?)!/
result['state'] = $2
end
end

View file

@ -226,7 +226,7 @@ returns
# see specs for example
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])
end
end

View file

@ -9,21 +9,19 @@ class KnowledgeBase::Category < ApplicationModel
belongs_to :knowledge_base, inverse_of: :categories
has_many :answers, class_name: 'KnowledgeBase::Answer',
foreign_key: :category_id,
inverse_of: :category,
dependent: :restrict_with_exception
has_many :answers, class_name: 'KnowledgeBase::Answer',
inverse_of: :category,
dependent: :restrict_with_exception
has_many :children, class_name: 'KnowledgeBase::Category',
foreign_key: :parent_id,
inverse_of: :parent,
dependent: :restrict_with_exception
belongs_to :parent, class_name: 'KnowledgeBase::Category',
foreign_key: :parent_id,
inverse_of: :children,
touch: true,
optional: true
belongs_to :parent, class_name: 'KnowledgeBase::Category',
inverse_of: :children,
touch: true,
optional: true
validates :category_icon, presence: true

View file

@ -21,7 +21,7 @@ class KnowledgeBase::MenuItem < ApplicationModel
url.strip!
return if url.match? %r{^\S+\:\/\/}
return if url.match? %r{^\S+://}
return if url[0] == '/'
self.url = "http://#{url}"

View file

@ -3,11 +3,8 @@
class StatsStore < ApplicationModel
include HasSearchIndexBackend
include StatsStore::SearchIndex
# rubocop:disable Rails/InverseOf
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
belongs_to :stats_store_object, class_name: 'ObjectLookup', optional: true
belongs_to :related_stats_store_object, class_name: 'ObjectLookup', optional: true
store :data

View file

@ -892,7 +892,7 @@ try to find correct name
# -no name- "firstname.lastname@example.com"
if string.blank? && email.present?
scan = email.scan(/^(.+?)\.(.+?)\@.+?$/)
scan = email.scan(/^(.+?)\.(.+?)@.+?$/)
if scan[0].present?
if scan[0][0].present?
firstname = scan[0][0].strip

View file

@ -8,7 +8,7 @@ if Kernel.respond_to?(:open_uri_original_open)
if name.respond_to?(:open) && name.method(:open).parameters.present?
name.open(*rest, &block)
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.open(*rest, &block)
else

View file

@ -137,7 +137,7 @@ class String
string.gsub!(%r{<a[[:space:]]+(|\S+[[:space:]]+)href=("|')(.+?)("|')([[:space:]]*|[[:space:]]+[^>]*)>(.+?)<[[:space:]]*/a[[:space:]]*>}mxi) do |_placeholder|
link = $3
text = $6
text.gsub!(/\<.+?\>/, '')
text.gsub!(/<.+?>/, '')
link_compare = link.dup
if link_compare.present?
@ -218,7 +218,7 @@ class String
string.gsub!(%r{</td>}i, ' ')
# strip all other tags
string.gsub!(/\<.+?\>/, '')
string.gsub!(/<.+?>/, '')
# replace multiple spaces with one
string.gsub!(/ /, ' ')
@ -348,8 +348,8 @@ class String
string.gsub!(/(<br>[[:space:]]*){3,}/im, '<br><br>')
string.gsub!(%r\(<br(|/)>[[:space:]]*){3,}\im, '<br/><br/>')
string.gsub!(%r{<p>[[:space:]]+</p>}im, '<p>&nbsp;</p>')
string.gsub!(%r{\A(<br(|\/)>[[:space:]]*)*}i, '')
string.gsub!(%r{[[:space:]]*(<br(|\/)>[[:space:]]*)*\Z}i, '')
string.gsub!(%r{\A(<br(|/)>[[:space:]]*)*}i, '')
string.gsub!(%r{[[:space:]]*(<br(|/)>[[:space:]]*)*\Z}i, '')
string.gsub!(%r{(<p></p>){1,10}\Z}i, '')
string.signature_identify('html')

View file

@ -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?
# add link to idoit

View file

@ -14,7 +14,7 @@ module Import
end
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
private

View file

@ -16,7 +16,7 @@ class Ldap
#
# @return [Boolean]
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
# Convers a given GUID string into the HEX equivalent.

View file

@ -105,7 +105,7 @@ examples how to use
end
arguments = nil
if /\A(?<method_id>[^\(]+)\((?<parameter>[^\)]+)\)\z/ =~ method
if /\A(?<method_id>[^(]+)\((?<parameter>[^)]+)\)\z/ =~ method
if parameter != parameter.to_i.to_s
value = "\#{#{object_name}.#{object_methods_s} / invalid parameter: #{parameter}}"

View file

@ -31,7 +31,7 @@ class Sequencer
# model___name
# model_name
# model_name
transliterated.gsub(%r{[\s\/]}, '_').underscore
transliterated.gsub(%r{[\s/]}, '_').underscore
end
def transliterated

View file

@ -41,8 +41,8 @@ module Zammad
Please increase this value in your #{vendor} configuration accordingly.
MSG
end
# Setting.get will fail if 'settings' table does not exist
rescue ActiveRecord::StatementInvalid
# Setting.get will fail if 'settings' table does not exist
end
def self.connection

View file

@ -86,6 +86,7 @@ module BrowserTestHelper
yield
rescue Capybara::ElementNotFound
# doesn't exist yet
end
rescue Selenium::WebDriver::Error::TimeOutError => e
# cleanup backtrace

View file

@ -7,7 +7,7 @@ class EmailBuildTest < ActiveSupport::TestCase
result = Channel::EmailBuild.html_complete_check(html)
assert(result.start_with?('<!DOCTYPE'), 'test 1')
assert(result !~ /^.+?<\!DOCTYPE/, 'test 1')
assert(result !~ /^.+?<!DOCTYPE/, 'test 1')
assert(result =~ /<html>/, 'test 1')
assert(result =~ /font-family/, '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>'
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 !~ /font-family/, 'test 2')
assert(result =~ %r{<b>test</b>}, 'test 2')