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

This commit is contained in:
Thorsten Eckel 2020-11-24 17:20:57 +01:00
parent cca33e4b5e
commit 85573432c0
24 changed files with 42 additions and 37 deletions

View file

@ -24,9 +24,9 @@ AllCops:
- 'public/assets/**/*'
- 'public/packs/**/*'
RSpec:
Patterns:
- '_spec.rb$'
- '_examples.rb$'
Include:
- "**/*_spec.rb"
- "**/*_examples.rb"
Rails:
Enabled: true

View file

@ -185,7 +185,7 @@ group :development, :test do
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-rails'
gem 'rubocop-rspec', '2.0.0.pre' # see: https://github.com/rubocop-hq/rubocop-rspec/issues/1051
gem 'rubocop-rspec'
# changelog generation
gem 'github_changelog_generator'

View file

@ -357,7 +357,7 @@ GEM
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0)
openssl (2.1.2)
parallel (1.20.0)
parallel (1.20.1)
parser (2.7.2.0)
ast (~> 2.4.1)
pg (0.21.0)
@ -452,7 +452,7 @@ GEM
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rszr (0.5.2)
rubocop (1.3.0)
rubocop (1.4.1)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
@ -463,15 +463,16 @@ GEM
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.1.1)
parser (>= 2.7.1.5)
rubocop-performance (1.8.1)
rubocop (>= 0.87.0)
rubocop-performance (1.9.0)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.8.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.87.0)
rubocop-rspec (2.0.0.pre)
rubocop-rspec (2.0.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.10.1)
ruby-saml (1.10.2)
nokogiri (>= 1.5.10)
@ -655,7 +656,7 @@ DEPENDENCIES
rubocop
rubocop-performance
rubocop-rails
rubocop-rspec (= 2.0.0.pre)
rubocop-rspec
rubyntlm!
sassc-rails
selenium-webdriver

View file

@ -7,7 +7,7 @@ class Issue2715FixBrokenTwitterUrlsJob < ApplicationJob
.where(ticket_article_types: { name: ['twitter status', 'twitter direct-message'] })
.order(created_at: :desc)
.limit(10_000)
.find_each(&method(:fix_broken_links))
.find_each { |article| fix_broken_links(article) }
end
private

View file

@ -116,7 +116,7 @@ cleanup old token
def with_context(user:, &block)
@effective_user = user
instance_eval(&block) if block_given?
instance_eval(&block) if block
ensure
@effective_user = nil
end

View file

@ -19,6 +19,7 @@ module ActiveRecord
end
end
end
module ActiveRecord
module ConnectionAdapters
module PostgreSQL

View file

@ -95,7 +95,7 @@ class String
end
c
end
.join('')
.join
end
=begin

View file

@ -1,6 +1,7 @@
module Exceptions
class NotAuthorized < StandardError; end
class UnprocessableEntity < StandardError; end
end

View file

@ -103,7 +103,7 @@ satinize html string based on whiltelist
# clean class / only use allowed classes
if node['class']
classes = node['class'].gsub(/\t|\n|\r/, '').split(' ')
classes = node['class'].gsub(/\t|\n|\r/, '').split
class_new = ''
classes.each do |local_class|
next if classes_whitelist.exclude?(local_class.to_s.strip)

View file

@ -33,7 +33,7 @@ module Import
def children(*parents)
return [] if parents.empty?
direct_descendants = parents.map(&method(:request_children))
direct_descendants = parents.map { |parent| request_children(parent) }
.flatten.uniq.compact
direct_descendants | children(*direct_descendants)

View file

@ -20,7 +20,7 @@ module Import
# Import::Helper::AttributesExamples.new do |extractor|
# extractor.extract(attributes)
# end
return if !block_given?
return if !block
if block.arity.zero?
instance_eval(&block)

View file

@ -31,9 +31,7 @@ class KnowledgeBase
return if params.blank?
params
.map { |location_params| update_location_using_params! knowledge_base, location_params }
.map(&:reload)
.sum
.map { |location_params| update_location_using_params! knowledge_base, location_params }.sum(&:reload)
end
# Mass-update KB menu items in a given location

View file

@ -92,7 +92,7 @@ class Ldap
# re-order according to oracle format index and join
oracle_format_indices = [3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15]
result = oracle_format_indices.map { |index| parts[index] }.join('')
result = oracle_format_indices.map { |index| parts[index] }.join
# add dashes if requested
return result if !dashify

View file

@ -44,7 +44,7 @@ returns
.map { |filename| data.merge(filename: filename) }
.map { |data_hash| TEMPLATE_PATH_STRING % data_hash }
found = candidates.find(&File.method(:exist?))
found = candidates.find { |candidate| File.exist?(candidate) }
raise FileNotFoundError, "Missing template files #{candidates}!" if !found

View file

@ -36,7 +36,7 @@ class Pseudonymisation
return '*' if source.length == 1
return "#{source.first}*#{source.last}" if source.exclude?(' ')
source.split(' ').map do |sub_string|
source.split.map do |sub_string|
of_string(sub_string)
end.join(' ')
end

View file

@ -44,17 +44,17 @@ class Sequencer
# Because it doesn't include associations
# stored on OTHER TABLES (has-one, has-many, HABTM)
def changes
@changes ||= unfiltered_changes.reject(&method(:no_diff?))
@changes ||= unfiltered_changes.reject { |_attribute, values| no_diff?(values) }
end
def unfiltered_changes
attrs = associations.keys
before = attrs.map(&instance.method(:send))
before = attrs.map { |attribute| instance.send(attribute) }
after = associations.values
attrs.zip(before.zip(after)).to_h.with_indifferent_access
end
def no_diff?(_, values)
def no_diff?(values)
values.map!(&:sort) if values.all? { |val| val.respond_to?(:sort) }
values.map!(&:presence) # [nil, []] -> [nil, nil]
values.uniq.length == 1

View file

@ -18,7 +18,7 @@ class Sequencer
end
def not_synced(entries)
entries.find(&method(:not_synced?))
entries.find { |entry| not_synced?(entry) }
end
def not_synced?(entry)

View file

@ -31,10 +31,10 @@ FactoryBot.define do
create(:knowledge_base_category, parent: obj)
level2 = create(:knowledge_base_category, parent: obj)
2.times { create(:knowledge_base_category, parent: level2) }
create_list(:knowledge_base_category, 2, parent: level2)
level3 = level2.children.reload.first
2.times { create(:knowledge_base_category, parent: level3) }
create_list(:knowledge_base_category, 2, parent: level3)
obj.reload
end

View file

@ -1,5 +1,5 @@
FactoryBot.define do
factory :notification_factory_renderer, class: NotificationFactory::Renderer do
factory :notification_factory_renderer, class: 'NotificationFactory::Renderer' do
objects { nil }
locale { 'en-en' }
template { '' }

View file

@ -1,5 +1,5 @@
FactoryBot.define do
factory :object_manager_attribute, class: ObjectManager::Attribute do
factory :object_manager_attribute, class: 'ObjectManager::Attribute' do
transient do
object_name { 'Ticket' }
additional_data_options { nil }

View file

@ -3,7 +3,7 @@ FactoryBot.define do
# add custom attributes via:
# mocked_entry = build(:ldap_entry)
# mocked_entry['attr'] = [value, another_value]
factory :ldap_entry, class: Net::LDAP::Entry do
factory :ldap_entry, class: 'Net::LDAP::Entry' do
initialize_with { new('dc=com') }
end
end

View file

@ -75,7 +75,7 @@ RSpec.describe SearchIndexBackend, searchindex: true do
QUERIES
it 'appends a * to the original query' do
expect(queries.map(&described_class.method(:append_wildcard_to_simple_query)))
expect(queries.map { |query| described_class.append_wildcard_to_simple_query(query) })
.to eq(queries.map { |q| "#{q}*" })
end
end
@ -117,7 +117,7 @@ RSpec.describe SearchIndexBackend, searchindex: true do
QUERIES
it 'returns the original query verbatim' do
expect(queries.map(&described_class.method(:append_wildcard_to_simple_query)))
expect(queries.map { |query| described_class.append_wildcard_to_simple_query(query) })
.to eq(queries)
end
end

View file

@ -115,7 +115,7 @@ module DbMigrationHelper
# remove_foreign_key(:online_notifications, :users)
#
# @return [nil]
def respond_to_missing?(*) # rubocop:disable Lint/MissingSuper
def respond_to_missing?(*)
true
end

View file

@ -92,6 +92,10 @@ RSpec.configure do |config|
end
end
config.around(:each, use_vcr: true, &RSpec::Support::VCRHelper.method(:inject_advisory))
config.around(:each, use_vcr: true, &RSpec::Expectations::VCRHelper.method(:inject_advisory))
config.around(:each, use_vcr: true) do |example|
RSpec::Support::VCRHelper.inject_advisory(example)
end
config.around(:each, use_vcr: true) do |example|
RSpec::Expectations::VCRHelper.inject_advisory(example)
end
end