Updated rubocop to latest version (0.74).

This commit is contained in:
Thorsten Eckel 2019-09-02 13:52:11 +02:00
parent 366a0b32e3
commit 40dcb0e132
19 changed files with 47 additions and 31 deletions

View file

@ -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$'

View file

@ -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

View file

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

View file

@ -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

View file

@ -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('_', '-')

View file

@ -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!

View file

@ -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],

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -100,6 +100,7 @@ class Store::Provider::File
parts.push sha[last_position, length3]
last_position = end_position
end
path = parts[ 0..6 ].join('/') + '/'
file = sha[last_position, sha.length]
location = "#{base}/#{path}"

View file

@ -25,7 +25,7 @@ satinize html string based on whiltelist
# We whitelist yahoo_quoted because Yahoo Mail marks quoted email content using
# <div class='yahoo_quoted'> and we rely on this class to identify quoted messages
classes_whitelist = ['js-signatureMarker', 'yahoo_quoted']
classes_whitelist = %w[js-signatureMarker yahoo_quoted]
attributes_2_css = %w[width height]
# remove html comments

View file

@ -24,7 +24,7 @@ class Sequencer
total = folder.total_count
per_page = 1000
pages = (total.to_f / per_page.to_f).ceil
pages = (total.to_f / per_page).ceil
display_path = ews_folder.display_path(folder)
(1..pages).each do |page|

View file

@ -519,6 +519,7 @@ get spool messages
def self.spool_list(timestamp, current_user_id)
path = "#{@path}/spool/"
FileUtils.mkpath path
data = []
to_delete = []
files = []

View file

@ -63,7 +63,7 @@ returns
# generate average param and icon state
backend_average_sum.each do |backend_model_average, result|
average = ( result.to_f / agent_count.to_f ).round(1)
average = ( result.to_f / agent_count ).round(1)
user_result.each do |user_id, data|
next if !data[backend_model_average]
next if !data[backend_model_average].key?(:used_for_average)

View file

@ -218,6 +218,7 @@ class AgentTicketAttachmentTest < TestCase
tasks_close_all(
browser: browser2,
)
random = 'ticket-actions-6-test-' + rand(999_999).to_s
user_email = random + '@example.com'
user_create(