Bump rubocop-performance from 1.10.2 to 1.11.0 (#13471)

* Bump rubocop-performance from 1.10.2 to 1.11.0

Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.10.2 to 1.11.0.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.10.2...v1.11.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Enable new cops and fix violations

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <rhymes@hey.com>
This commit is contained in:
dependabot[bot] 2021-04-22 09:31:25 -05:00 committed by GitHub
parent 447a8ab908
commit 29dcea3750
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 14 deletions

View file

@ -690,16 +690,20 @@ Performance/IoReadlines:
Reference: 'https://docs.gitlab.com/ee/development/performance.html#reading-from-files-and-other-data-sources'
Enabled: true
Performance/RedundantEqualityComparisonBlock:
Description: >-
Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`,
or `Enumerable#none?` are compared with `===` or similar methods in block.
Performance/MapCompact:
Description: 'Use `filter_map` instead of `collection.map(&:do_something).compact`.'
Enabled: true
Performance/OpenStruct:
Description: 'Use `Struct` instead of `OpenStruct`.'
Enabled: true
Performance/RedundantEqualityComparisonBlock:
Description: >-
Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`,
or `Enumerable#none?` are compared with `===` or similar methods in block.
Enabled: true
Performance/RedundantSortBlock:
Description: 'Use `sort` instead of `sort { |a, b| a <=> b }`.'
Enabled: true
@ -716,6 +720,10 @@ Performance/ReverseFirst:
Description: 'Use `last(n).reverse` instead of `reverse.first(n)`.'
Enabled: true
Performance/SelectMap:
Description: 'Use `filter_map` instead of `ary.select(&:foo).map(&:bar)`.'
Enabled: true
Performance/SortReverse:
Description: 'Use `sort.reverse` instead of `sort { |a, b| b <=> a }`.'
Enabled: true

View file

@ -150,7 +150,7 @@ group :development, :test do
gem "pry-byebug", "~> 3.8" # Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish', 'continue' and 'break' commands to control execution
gem "rspec-rails", "~> 5.0" # rspec-rails is a testing framework for Rails 3+
gem "rubocop", "~> 1.13", require: false # Automatic Ruby code style checking tool
gem "rubocop-performance", "~> 1.10", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code
gem "rubocop-performance", "~> 1.11", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code
gem "rubocop-rails", "~> 2.9", require: false # Automatic Rails code style checking tool
gem "rubocop-rspec", "~> 2.2", require: false # Code style checking for RSpec files
gem "sassc-rails", "~> 2.1.2" # Integrate SassC-Ruby into Rails

View file

@ -672,8 +672,8 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-performance (1.10.2)
rubocop (>= 0.90.0, < 2.0)
rubocop-performance (1.11.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
@ -967,7 +967,7 @@ DEPENDENCIES
rspec-rails (~> 5.0)
rspec-retry (~> 0.6)
rubocop (~> 1.13)
rubocop-performance (~> 1.10)
rubocop-performance (~> 1.11)
rubocop-rails (~> 2.9)
rubocop-rspec (~> 2.2)
ruby-prof (~> 1.4)

View file

@ -131,9 +131,9 @@ module Broadcasts
end
def find_auth_broadcast
missing_identities = Authentication::Providers.enabled.map do |provider|
missing_identities = Authentication::Providers.enabled.filter_map do |provider|
identities.exists?(provider: provider) ? nil : "#{provider}_connect"
end.compact
end
Broadcast.active.find_by!(title: "Welcome Notification: #{missing_identities.first}")
end

View file

@ -117,7 +117,7 @@ module Search
def process_hashes(indexing_hashes)
indexing_hashes.in_groups_of(1000, false).flat_map do |hashes|
indexing_chunks(hashes).select(&:any?).map { |chunk| Search::Client.bulk(body: chunk) }
indexing_chunks(hashes).filter_map { |chunk| Search::Client.bulk(body: chunk) }
end
end

View file

@ -67,12 +67,12 @@ module Search
def parse_and_order_articles(articles)
# Combines reaction and article data to create hashes that contain the fields
# the reading list view needs. Ensures articles are returned in order of reaction ID
reading_list_article_ids.map do |article_id, reaction_id|
reading_list_article_ids.filter_map do |article_id, reaction_id|
found_article_doc = articles[article_id]
next unless found_article_doc
{ "id" => reaction_id, "user_id" => user.id, "reactable" => articles[article_id] }
end.compact
end
end
end
end

View file

@ -432,7 +432,7 @@ RSpec.describe "NotificationsIndex", type: :request do
get notifications_path(filter: :org, org_id: other_org.id)
notifications = controller.instance_variable_get(:@notifications)
expect(notifications.map(&:organization_id).compact.size).to eq(0)
expect(notifications.filter_map(&:organization_id).size).to eq(0)
end
it "does render notifications belonging to other orgs if admin" do

Binary file not shown.

Binary file not shown.