Browse Source

Updated rubocop to latest version (0.74).

Thorsten Eckel 5 years ago
parent
commit
40dcb0e132

+ 2 - 0
.rubocop.yml

@@ -3,6 +3,7 @@
 
 require:
   - rubocop-performance
+  - rubocop-rails
   - rubocop-rspec
 
 inherit_from:
@@ -17,6 +18,7 @@ AllCops:
     - 'bin/spring'
     - 'db/schema.rb'
     - 'vendor/**/*'
+    - 'public/assets/**/*'
   RSpec:
     Patterns:
       - '_spec.rb$'

+ 16 - 9
.rubocop_todo.yml

@@ -1,12 +1,12 @@
 # This configuration was generated by
 # `rubocop --auto-gen-config`
-# on 2019-04-12 18:08:21 +0800 using RuboCop version 0.67.2.
+# on 2019-09-02 13:20:31 +0200 using RuboCop version 0.74.0.
 # The point is for the user to remove these configuration records
 # one by one as the offenses are removed from the code base.
 # Note that changes in the inspected code, or installation of new
 # versions of RuboCop, may require this file to be generated again.
 
-# Offense count: 97
+# Offense count: 163
 # Cop supports --auto-correct.
 # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
 Layout/ExtraSpacing:
@@ -25,25 +25,25 @@ Lint/MissingCopEnableDirective:
     - 'lib/import/otrs/user_factory.rb'
     - 'lib/import/transaction_factory.rb'
 
-# Offense count: 469
+# Offense count: 833
 Metrics/AbcSize:
   Max: 637
 
-# Offense count: 28
+# Offense count: 29
 # Configuration parameters: CountBlocks.
 Metrics/BlockNesting:
   Max: 5
 
-# Offense count: 336
+# Offense count: 340
 Metrics/CyclomaticComplexity:
   Max: 97
 
-# Offense count: 23
+# Offense count: 27
 # Configuration parameters: CountComments.
 Metrics/ModuleLength:
   Max: 559
 
-# Offense count: 272
+# Offense count: 274
 Metrics/PerceivedComplexity:
   Max: 115
 
@@ -94,11 +94,18 @@ Rails/HasManyOrHasOneDependent:
     - 'app/models/ticket/state_type.rb'
     - 'app/models/user.rb'
 
-# Offense count: 759
+# Offense count: 15
+# Configuration parameters: Include.
+# Include: app/helpers/**/*.rb
+Rails/HelperInstanceVariable:
+  Exclude:
+    - 'app/helpers/knowledge_base_helper.rb'
+
+# Offense count: 808
 Style/Documentation:
   Enabled: false
 
-# Offense count: 170
+# Offense count: 172
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: implicit, explicit

+ 1 - 0
Gemfile

@@ -176,6 +176,7 @@ group :development, :test do
   gem 'pre-commit'
   gem 'rubocop'
   gem 'rubocop-performance'
+  gem 'rubocop-rails'
   gem 'rubocop-rspec'
 
   # changelog generation

+ 11 - 9
Gemfile.lock

@@ -255,7 +255,7 @@ GEM
     ice_cube (0.16.3)
     inflection (1.0.0)
     interception (0.5)
-    jaro_winkler (1.5.2)
+    jaro_winkler (1.5.3)
     json (2.2.0)
     jwt (2.1.0)
     kgio (2.11.2)
@@ -352,7 +352,7 @@ GEM
       omniauth (~> 1.5)
       omniauth-oauth2 (>= 1.4.0)
     parallel (1.17.0)
-    parser (2.6.3.0)
+    parser (2.6.4.0)
       ast (~> 2.4.0)
     pg (0.21.0)
     pluginator (1.5.0)
@@ -373,7 +373,6 @@ GEM
     pry-stack_explorer (0.4.9.3)
       binding_of_caller (>= 0.7)
       pry (>= 0.9.11)
-    psych (3.1.0)
     public_suffix (3.0.3)
     puma (3.12.1)
     rack (2.0.7)
@@ -442,19 +441,21 @@ GEM
       rspec-support (~> 3.8.0)
     rspec-support (3.8.0)
     rszr (0.5.2)
-    rubocop (0.67.2)
+    rubocop (0.74.0)
       jaro_winkler (~> 1.5.1)
       parallel (~> 1.10)
-      parser (>= 2.5, != 2.5.1.1)
-      psych (>= 3.1.0)
+      parser (>= 2.6)
       rainbow (>= 2.2.2, < 4.0)
       ruby-progressbar (~> 1.7)
-      unicode-display_width (>= 1.4.0, < 1.6)
+      unicode-display_width (>= 1.4.0, < 1.7)
     rubocop-performance (1.1.0)
       rubocop (>= 0.67.0)
+    rubocop-rails (2.3.2)
+      rack (>= 1.1)
+      rubocop (>= 0.72.0)
     rubocop-rspec (1.33.0)
       rubocop (>= 0.60.0)
-    ruby-progressbar (1.10.0)
+    ruby-progressbar (1.10.1)
     ruby_dep (1.5.0)
     rubyzip (1.2.2)
     safe_yaml (1.0.5)
@@ -521,7 +522,7 @@ GEM
     unf (0.1.4)
       unf_ext
     unf_ext (0.0.7.5)
-    unicode-display_width (1.5.0)
+    unicode-display_width (1.6.0)
     unicorn (5.5.0)
       kgio (~> 2.6)
       raindrops (~> 0.7)
@@ -629,6 +630,7 @@ DEPENDENCIES
   rszr (= 0.5.2)
   rubocop
   rubocop-performance
+  rubocop-rails
   rubocop-rspec
   rubyntlm!
   sassc-rails

+ 2 - 2
app/controllers/concerns/creates_ticket_articles.rb

@@ -79,14 +79,14 @@ module CreatesTicketArticles
       params[:attachments].each_with_index do |attachment, index|
 
         # validation
-        ['mime-type', 'filename', 'data'].each do |key|
+        %w[mime-type filename data].each do |key|
           next if attachment[key]
 
           raise Exceptions::UnprocessableEntity, "Attachment needs '#{key}' param for attachment with index '#{index}'"
         end
 
         preferences = {}
-        ['charset', 'mime-type'].each do |key|
+        %w[charset mime-type].each do |key|
           next if !attachment[key]
 
           store_key = key.tr('-', '_').camelize.gsub(/(.+)([A-Z])/, '\1_\2').tr('_', '-')

+ 1 - 0
app/jobs/ticket_article_communicate_email_job.rb

@@ -154,6 +154,7 @@ class TicketArticleCommunicateEmailJob < ApplicationJob
           notification:                true,
         },
       )
+
       ticket       = Ticket.find(local_record.ticket_id)
       ticket.state = Ticket::State.find_by(default_follow_up: true)
       ticket.save!

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

@@ -724,7 +724,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
     # e. g. Content-Type: video/quicktime
     if filename.blank?
       map = {
-        'message/delivery-status': ['txt', 'delivery-status'],
+        'message/delivery-status': %w[txt delivery-status],
         'text/plain':              %w[txt document],
         'text/html':               %w[html document],
         'video/quicktime':         %w[mov video],

+ 1 - 1
app/models/channel/filter/identify_sender.rb

@@ -94,7 +94,7 @@ module Channel::Filter::IdentifySender
   def self.create_recipients(mail)
     max_count = 40
     current_count = 0
-    ['raw-to', 'raw-cc'].each do |item|
+    %w[raw-to raw-cc].each do |item|
       next if mail[item.to_sym].blank?
 
       begin

+ 1 - 1
app/models/locale.rb

@@ -22,7 +22,7 @@ returns
   def self.to_sync
     locales = Locale.where(active: true)
     if Rails.env.test?
-      locales = Locale.where(active: true, locale: ['en-us', 'de-de'])
+      locales = Locale.where(active: true, locale: %w[en-us de-de])
     end
 
     # read used locales based on env, e. g. export Z_LOCALES='en-us:de-de'

+ 2 - 2
app/models/package.rb

@@ -133,7 +133,7 @@ execute migration down + unlink files
     Dir.glob(package_base_dir + '/**/*') do |entry|
       entry = entry.sub('//', '/')
       file = entry
-      file = file.sub(/#{package_base_dir.to_s}/, '')
+      file = file.sub(/#{package_base_dir}/, '')
       dest = @@root + '/' + file
 
       if File.symlink?(dest.to_s)
@@ -166,7 +166,7 @@ link files + execute migration up
     Dir.glob(package_base_dir + '/**/*') do |entry|
       entry = entry.sub('//', '/')
       file = entry
-      file = file.sub(/#{package_base_dir.to_s}/, '')
+      file = file.sub(/#{package_base_dir}/, '')
       file = file.sub(%r{^/}, '')
 
       # ignore files

Some files were not shown because too many files changed in this diff