Browse Source

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

Thorsten Eckel 4 years ago
parent
commit
562c842c8a

+ 11 - 0
.rubocop.yml

@@ -18,7 +18,9 @@ AllCops:
     - 'bin/spring'
     - 'db/schema.rb'
     - 'vendor/**/*'
+    - 'node_modules/**/*'
     - 'public/assets/**/*'
+    - 'public/packs/**/*'
   RSpec:
     Patterns:
       - '_spec.rb$'
@@ -242,6 +244,15 @@ Lint/InterpolationCheck:
     - "test/unit/ticket_trigger_test.rb"
     - "test/unit/ticket_trigger_recursive_disabled_test.rb"
 
+Lint/RaiseException:
+  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
+  StyleGuide: "#raise-exception"
+  Enabled: true
+
+Lint/StructNewOverride:
+  Description: "Disallow overriding the `Struct` built-in methods via `Struct.new`."
+  Enabled: true
+
 # RSpec tests
 Style/NumericPredicate:
   Description: >-

+ 6 - 5
Gemfile.lock

@@ -355,7 +355,7 @@ GEM
       omniauth (~> 1.5)
       omniauth-oauth2 (>= 1.4.0)
     parallel (1.19.1)
-    parser (2.7.0.2)
+    parser (2.7.1.0)
       ast (~> 2.4.0)
     pg (0.21.0)
     pluginator (1.5.0)
@@ -449,17 +449,18 @@ GEM
       rspec-support (~> 3.8.0)
     rspec-support (3.8.0)
     rszr (0.5.2)
-    rubocop (0.80.0)
+    rubocop (0.81.0)
       jaro_winkler (~> 1.5.1)
       parallel (~> 1.10)
       parser (>= 2.7.0.1)
       rainbow (>= 2.2.2, < 4.0)
       rexml
       ruby-progressbar (~> 1.7)
-      unicode-display_width (>= 1.4.0, < 1.7)
+      unicode-display_width (>= 1.4.0, < 2.0)
     rubocop-performance (1.5.2)
       rubocop (>= 0.71.0)
-    rubocop-rails (2.4.2)
+    rubocop-rails (2.5.2)
+      activesupport
       rack (>= 1.1)
       rubocop (>= 0.72.0)
     rubocop-rspec (1.38.1)
@@ -532,7 +533,7 @@ GEM
     unf (0.1.4)
       unf_ext
     unf_ext (0.0.7.5)
-    unicode-display_width (1.6.1)
+    unicode-display_width (1.7.0)
     unicorn (5.5.0)
       kgio (~> 2.6)
       raindrops (~> 0.7)

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

@@ -517,7 +517,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
     end.to_h
 
     # imported_fields = mail.header.fields.map { |f| [f.name.downcase, f.to_utf8] }.to_h
-    raw_fields = mail.header.fields.map { |f| ["raw-#{f.name.downcase}", f] }.to_h
+    raw_fields = mail.header.fields.index_by { |f| "raw-#{f.name.downcase}" }
     custom_fields = {}.tap do |h|
       h.replace(imported_fields.slice(*RECIPIENT_FIELDS)
                                .transform_values { |v| v.match?(EMAIL_REGEX) ? v : '' })

+ 1 - 1
db/migrate/20120101000001_create_base.rb

@@ -207,7 +207,7 @@ class CreateBase < ActiveRecord::Migration[4.2]
       t.references :user, null: false
       t.timestamps limit: 3, null: false
     end
-    add_index :authorizations, %i[uid provider]
+    add_index :authorizations, %i[uid provider], unique: true
     add_index :authorizations, [:user_id]
     add_index :authorizations, [:username]
     add_foreign_key :authorizations, :users

+ 1 - 3
lib/import/exchange/folder.rb

@@ -13,9 +13,7 @@ module Import
       end
 
       def id_folder_map
-        @id_folder_map ||= all.collect do |folder|
-          [folder.id, folder]
-        end.to_h
+        @id_folder_map ||= all.index_by(&:id)
 
         # duplicate object to avoid errors where keys get
         # added via #get_folder while iterating over

+ 7 - 7
test/browser_test_helper.rb

@@ -1,5 +1,5 @@
 ENV['RAILS_ENV'] = 'test'
-# rubocop:disable Lint/SuppressedException, Lint/NonLocalExitFromIterator, Style/GuardClause, Lint/MissingCopEnableDirective
+# rubocop:disable Lint/NonLocalExitFromIterator, Style/GuardClause, Lint/MissingCopEnableDirective
 require File.expand_path('../config/environment', __dir__)
 require 'selenium-webdriver'
 require 'json'
@@ -1475,7 +1475,7 @@ set type of task (closeTab, closeNextInOverview, stayOnTab)
               return true
             end
           end
-        rescue # rubocop:disable Lint/SuppressedException
+        rescue
           # try again
         end
       end
@@ -1537,7 +1537,7 @@ wait untill text in selector disabppears
             sleep 1
             return true
           end
-        rescue # rubocop:disable Lint/SuppressedException
+        rescue
           # try again
         end
       end
@@ -1700,7 +1700,7 @@ wait untill text in selector disabppears
         else
           break
         end
-      rescue # rubocop:disable Lint/SuppressedException
+      rescue
         # try again
       end
     end
@@ -2542,7 +2542,7 @@ wait untill text in selector disabppears
           if text.match?(/(Discard your unsaved changes.|Verwerfen der)/)
             found = true
           end
-        rescue # rubocop:disable Lint/SuppressedException
+        rescue
           # try again
         end
         sleep 1
@@ -2580,7 +2580,7 @@ wait untill text in selector disabppears
           sleep 1
           return true
         end
-      rescue # rubocop:disable Lint/SuppressedException
+      rescue
         # try again
       end
       sleep 1
@@ -4485,7 +4485,7 @@ wait untill text in selector disabppears
           puts "#{time}/#{log.level}: #{log.message}"
         end
       end
-    rescue # rubocop:disable Lint/SuppressedException
+    rescue
       # failed to get logs
     end
     return if !DEBUG