diff --git a/.rubocop.yml b/.rubocop.yml index 77ee1f4be..9fc101d53 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -686,6 +686,12 @@ 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. + Enabled: true + Performance/OpenStruct: Description: 'Use `Struct` instead of `OpenStruct`.' Enabled: true @@ -694,6 +700,10 @@ Performance/RedundantSortBlock: Description: 'Use `sort` instead of `sort { |a, b| a <=> b }`.' Enabled: true +Performance/RedundantSplitRegexpArgument: + Description: 'This cop identifies places where `split` argument can be replaced from a deterministic regexp to a string.' + Enabled: true + Performance/RedundantStringChars: Description: 'Checks for redundant `String#chars`.' Enabled: true diff --git a/Gemfile b/Gemfile index 40fedb04c..3ab644e69 100644 --- a/Gemfile +++ b/Gemfile @@ -148,7 +148,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", "~> 4.0" # rspec-rails is a testing framework for Rails 3+ gem "rubocop", "~> 1.11", require: false # Automatic Ruby code style checking tool - gem "rubocop-performance", "~> 1.9", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code + gem "rubocop-performance", "~> 1.10", 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 diff --git a/Gemfile.lock b/Gemfile.lock index c3a4d75d8..254d3e4ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -672,7 +672,7 @@ GEM unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.4.1) parser (>= 2.7.1.5) - rubocop-performance (1.9.2) + rubocop-performance (1.10.1) rubocop (>= 0.90.0, < 2.0) rubocop-ast (>= 0.4.0) rubocop-rails (2.9.1) @@ -963,7 +963,7 @@ DEPENDENCIES rspec-rails (~> 4.0) rspec-retry (~> 0.6) rubocop (~> 1.11) - rubocop-performance (~> 1.9) + rubocop-performance (~> 1.10) rubocop-rails (~> 2.9) rubocop-rspec (~> 2.2) ruby-prof (~> 1.4) diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 39663a03f..5e2a5ec96 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -19,7 +19,7 @@ module CommentsHelper [ commentable.user_id, commentable.co_author_ids, - ].flatten.any? { |id| id == comment.user_id } + ].flatten.any?(comment.user_id) end def get_ama_or_op_banner(commentable) diff --git a/vendor/cache/rubocop-performance-1.10.1.gem b/vendor/cache/rubocop-performance-1.10.1.gem new file mode 100644 index 000000000..d898f1d9a Binary files /dev/null and b/vendor/cache/rubocop-performance-1.10.1.gem differ diff --git a/vendor/cache/rubocop-performance-1.9.2.gem b/vendor/cache/rubocop-performance-1.9.2.gem deleted file mode 100644 index a60571bdd..000000000 Binary files a/vendor/cache/rubocop-performance-1.9.2.gem and /dev/null differ