Browse Source

Maintenance: Bump rubocop from 1.21.0 to 1.22.0

Martin Gruner 3 years ago
parent
commit
51933e3b76

+ 2 - 2
Gemfile.lock

@@ -498,13 +498,13 @@ GEM
       rspec-support (~> 3.10)
     rspec-support (3.10.2)
     rszr (0.5.2)
-    rubocop (1.21.0)
+    rubocop (1.22.0)
       parallel (~> 1.10)
       parser (>= 3.0.0.0)
       rainbow (>= 2.2.2, < 4.0)
       regexp_parser (>= 1.8, < 3.0)
       rexml
-      rubocop-ast (>= 1.9.1, < 2.0)
+      rubocop-ast (>= 1.12.0, < 2.0)
       ruby-progressbar (~> 1.7)
       unicode-display_width (>= 1.4.0, < 3.0)
     rubocop-ast (1.12.0)

+ 1 - 1
app/models/channel/email_parser.rb

@@ -502,7 +502,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
     path = Rails.root.join('tmp/unprocessable_mail')
     files = []
     Dir.glob("#{path}/*.eml") do |entry|
-      ticket, _article, _user, _mail = Channel::EmailParser.new.process(params, IO.binread(entry))
+      ticket, _article, _user, _mail = Channel::EmailParser.new.process(params, File.binread(entry))
       next if ticket.blank?
 
       files.push entry

+ 2 - 2
lib/html_sanitizer.rb

@@ -161,8 +161,8 @@ satinize html string based on whiltelist
         # wrap plain-text URLs in <a> tags
         if node.is_a?(Nokogiri::XML::Text) && node.content.present? && node.content.include?(':') && node.ancestors.map(&:name).exclude?('a')
           urls = URI.extract(node.content, LINKABLE_URL_SCHEMES)
-                    .map { |u| u.sub(%r{[,.]$}, '') }      # URI::extract captures trailing dots/commas
-                    .reject { |u| u.match?(%r{^[^:]+:$}) } # URI::extract will match, e.g., 'tel:'
+                    .map { |u| u.sub(%r{[,.]$}, '') } # URI::extract captures trailing dots/commas
+                    .grep_v(%r{^[^:]+:$}) # URI::extract will match, e.g., 'tel:'
 
           next if urls.blank?
 

+ 2 - 6
test/integration/email_postmaster_to_sender.rb

@@ -104,9 +104,7 @@ Oversized Email Message Body #{'#' * 120_000}
     # 1. verify that the oversized email has been saved locally to:
     # /tmp/oversized_mail/yyyy-mm-ddThh:mm:ss-:md5.eml
     path = Rails.root.join('tmp/oversized_mail')
-    target_files = Dir.entries(path).select do |filename|
-      filename =~ %r{^#{large_message_md5}\.eml$}
-    end
+    target_files = Dir.entries(path).grep(%r{^#{large_message_md5}\.eml$})
     assert(target_files.present?, 'Large message .eml log file must be present.')
 
     # pick the latest file that matches the criteria
@@ -193,9 +191,7 @@ Oversized Email Message Body #{'#' * 120_000}
     # 1. verify that the oversized email has been saved locally to:
     # /tmp/oversized_mail/yyyy-mm-ddThh:mm:ss-:md5.eml
     path = Rails.root.join('tmp/oversized_mail')
-    target_files = Dir.entries(path).select do |filename|
-      filename =~ %r{^.+?\.eml$}
-    end
+    target_files = Dir.entries(path).grep(%r{^.+?\.eml$})
     assert_not(target_files.blank?, 'Large message .eml log file must be blank.')
 
     # 2. verify that a postmaster response email has been sent to the sender

+ 1 - 1
test/test_helper.rb

@@ -62,7 +62,7 @@ class ActiveSupport::TestCase
     # read config file and count type & recipients
     file = Rails.root.join('log', "#{Rails.env}.log")
     lines = []
-    IO.foreach(file) do |line|
+    File.foreach(file) do |line|
       lines.push line
     end
     count = 0