Browse Source

Maintenance: Updated rubocop(-* gems) to latest version (0.80.0).

Thorsten Eckel 5 years ago
parent
commit
a976b9fb43

+ 12 - 7
.rubocop.yml

@@ -32,7 +32,7 @@ Rails:
 Style/FrozenStringLiteralComment:
   Enabled: false
 
-Metrics/LineLength:
+Layout/LineLength:
   Description: 'Limit lines to 80 characters.'
   StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
   Enabled: false
@@ -106,7 +106,7 @@ Style/MethodDefParentheses:
   StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
   Enabled: false
 
-Layout/AlignHash:
+Layout/HashAlignment:
   Description: >-
                  Align the elements of a hash literal if they span more than
                  one line.
@@ -155,6 +155,15 @@ Style/PerlBackrefs:
   StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
   Enabled: false
 
+Style/HashEachMethods:
+  Enabled: true
+
+Style/HashTransformKeys:
+  Enabled: true
+
+Style/HashTransformValues:
+  Enabled: true
+
 Style/SelfAssignment:
   Description: >-
                  Checks for places where self-assignment shorthand should have
@@ -162,10 +171,6 @@ Style/SelfAssignment:
   StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
   Enabled: false
 
-Style/BracesAroundHashParameters:
-  Description: 'Enforce braces style around hash parameters.'
-  Enabled: false
-
 Rails/ApplicationRecord:
   Exclude:
     - 'app/models/application_model.rb'
@@ -210,7 +215,7 @@ Naming/VariableNumber:
   Description: 'Use the configured style when numbering variables.'
   Enabled: false
 
-Naming/UncommunicativeMethodParamName:
+Naming/MethodParameterName:
   Description: >-
                 Checks for method parameter names that contain capital letters,
                 end in numbers, or do not meet a minimal length.

+ 1 - 0
.rubocop_todo.rspec.yml

@@ -170,6 +170,7 @@ RSpec/ScatteredSetup:
 # Offense count: 8
 RSpec/SubjectStub:
   Exclude:
+    - 'spec/lib/import/exchange/folder_spec.rb'
     - 'spec/models/concerns/has_groups_examples.rb'
     - 'spec/models/concerns/has_roles_examples.rb'
     - 'spec/models/job_spec.rb'

+ 12 - 10
Gemfile.lock

@@ -255,7 +255,7 @@ GEM
     ice_cube (0.16.3)
     inflection (1.0.0)
     interception (0.5)
-    jaro_winkler (1.5.3)
+    jaro_winkler (1.5.4)
     json (2.2.0)
     jwt (2.2.1)
     kgio (2.11.2)
@@ -354,8 +354,8 @@ GEM
     omniauth-weibo-oauth2 (0.5.2)
       omniauth (~> 1.5)
       omniauth-oauth2 (>= 1.4.0)
-    parallel (1.17.0)
-    parser (2.6.4.0)
+    parallel (1.19.1)
+    parser (2.7.0.2)
       ast (~> 2.4.0)
     pg (0.21.0)
     pluginator (1.5.0)
@@ -426,6 +426,7 @@ GEM
       mime-types (>= 1.16, < 4.0)
       netrc (~> 0.8)
     retriable (2.1.0)
+    rexml (3.2.4)
     rspec-core (3.8.0)
       rspec-support (~> 3.8.0)
     rspec-expectations (3.8.2)
@@ -444,20 +445,21 @@ GEM
       rspec-support (~> 3.8.0)
     rspec-support (3.8.0)
     rszr (0.5.2)
-    rubocop (0.74.0)
+    rubocop (0.80.0)
       jaro_winkler (~> 1.5.1)
       parallel (~> 1.10)
-      parser (>= 2.6)
+      parser (>= 2.7.0.1)
       rainbow (>= 2.2.2, < 4.0)
+      rexml
       ruby-progressbar (~> 1.7)
       unicode-display_width (>= 1.4.0, < 1.7)
-    rubocop-performance (1.4.1)
+    rubocop-performance (1.5.2)
       rubocop (>= 0.71.0)
-    rubocop-rails (2.3.2)
+    rubocop-rails (2.4.2)
       rack (>= 1.1)
       rubocop (>= 0.72.0)
-    rubocop-rspec (1.35.0)
-      rubocop (>= 0.60.0)
+    rubocop-rspec (1.38.1)
+      rubocop (>= 0.68.1)
     ruby-progressbar (1.10.1)
     ruby-saml (1.10.2)
       nokogiri (>= 1.5.10)
@@ -526,7 +528,7 @@ GEM
     unf (0.1.4)
       unf_ext
     unf_ext (0.0.7.5)
-    unicode-display_width (1.6.0)
+    unicode-display_width (1.6.1)
     unicorn (5.5.0)
       kgio (~> 2.6)
       raindrops (~> 0.7)

+ 1 - 1
app/controllers/channels_sms_controller.rb

@@ -66,7 +66,7 @@ class ChannelsSmsController < ApplicationChannelController
 
   def channels_config
     list = []
-    Dir.glob(Rails.root.join('app', 'models', 'channel', 'driver', 'sms', '*.rb')).each do |path|
+    Dir.glob(Rails.root.join('app/models/channel/driver/sms/*.rb')).each do |path|
       filename = File.basename(path)
       require_dependency "channel/driver/sms/#{filename.sub('.rb', '')}"
       list.push Channel.driver_class("sms/#{filename}").definition

+ 1 - 1
app/controllers/monitoring_controller.rb

@@ -64,7 +64,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
     end
 
     # unprocessable mail check
-    directory = Rails.root.join('tmp', 'unprocessable_mail').to_s
+    directory = Rails.root.join('tmp/unprocessable_mail').to_s
     if File.exist?(directory)
       count = 0
       Dir.glob("#{directory}/*.eml") do |_entry|

+ 1 - 1
app/models/application_model/has_attachments.rb

@@ -54,7 +54,7 @@ store attachments for this object
     self.attachments_buffer = attachments
 
     # update if object already exists
-    return if !(id&.nonzero?)
+    return if !id&.nonzero?
 
     attachments_buffer_check
   end

+ 2 - 2
app/models/calendar.rb

@@ -86,7 +86,7 @@ returns
 =end
 
   def self.ical_feeds
-    data = YAML.load_file(Rails.root.join('config', 'holiday_calendars.yml'))
+    data = YAML.load_file(Rails.root.join('config/holiday_calendars.yml'))
     url  = data['url']
 
     data['countries'].map do |country, domain|
@@ -256,7 +256,7 @@ returns
 
   # get day and comment by event
   def self.day_and_comment_by_event(event, start_time)
-    day = "#{start_time.year}-#{format('%02d', start_time.month)}-#{format('%02d', start_time.day)}"
+    day = "#{start_time.year}-#{format('%<month>02d', month: start_time.month)}-#{format('%<day>02d', day: start_time.day)}"
     comment = event.summary || event.description
     comment = comment.to_utf8(fallback: :read_as_sanitized_binary)
 

+ 3 - 3
app/models/channel.rb

@@ -58,7 +58,7 @@ fetch one account
       self.last_log_in = result[:notice]
       preferences[:last_fetch] = Time.zone.now
       save!
-      return true
+      true
     rescue => e
       error = "Can't use Channel::Driver::#{adapter.to_classname}: #{e.inspect}"
       logger.error error
@@ -67,7 +67,7 @@ fetch one account
       self.last_log_in = error
       preferences[:last_fetch] = Time.zone.now
       save!
-      return false
+      false
     end
   end
 
@@ -98,7 +98,7 @@ stream instance of account
 
       # set scheduler job to active
 
-      return driver_instance
+      driver_instance
     rescue => e
       error = "Can't use Channel::Driver::#{adapter.to_classname}: #{e.inspect}"
       logger.error error

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

@@ -153,7 +153,7 @@ Check if string is a complete html document. If not, add head and css styles.
 
     return html if html.match?(/<html>/i)
 
-    html_email_body = File.read(Rails.root.join('app', 'views', 'mailer', 'application_wrapper.html.erb').to_s)
+    html_email_body = File.read(Rails.root.join('app/views/mailer/application_wrapper.html.erb').to_s)
 
     html_email_body.gsub!('###html_email_css_font###', Setting.get('html_email_css_font'))
 

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

@@ -473,7 +473,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
 =end
 
   def self.process_unprocessable_mails(params = {})
-    path = Rails.root.join('tmp', 'unprocessable_mail')
+    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))
@@ -847,7 +847,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
     mail = OpenStruct.new
     mail.from_display_name = parsed_incoming_mail[:from_display_name]
     mail.subject = parsed_incoming_mail[:subject]
-    mail.msg_size = format('%.2f', raw_incoming_mail.size.to_f / 1024 / 1024)
+    mail.msg_size = format('%<MB>.2f', MB: raw_incoming_mail.size.to_f / 1024 / 1024)
 
     reply = NotificationFactory::Mailer.template(
       template:   'email_oversized',

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