From 1ff46d3bcf9aa4e9173a41de4129e9b027058248 Mon Sep 17 00:00:00 2001 From: ydah Date: Thu, 15 Feb 2024 19:15:52 +0900 Subject: [PATCH] Enable cop for pending rubocop-performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ❯ bundle exec rubocop Inspecting 42 files .......................................C.. Offenses: spec/spec_helper.rb:17:9: C: Performance/MethodObjectAsBlock: Use block explicitly instead of block-passing a method object. .each(&method(:require)) ^^^^^^^^^^^^^^^^^ 42 files inspected, 1 offense detected ``` --- .rubocop.yml | 37 +++++++++++++++++++++++++++++++++++++ spec/spec_helper.rb | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index bf9fabd0..dfef3e3d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -135,6 +135,43 @@ Style/RedundantStringEscape: Style/ReturnNilInPredicateMethodDefinition: Enabled: true +# Enable pending rubocop-performance cops. + +Performance/AncestorsInclude: + Enabled: true +Performance/BlockGivenWithExplicitBlock: + Enabled: true +Performance/CollectionLiteralInLoop: + Enabled: true +Performance/ConstantRegexp: + Enabled: true +Performance/MapCompact: + Enabled: true +Performance/MapMethodChain: + Enabled: true +Performance/MethodObjectAsBlock: + Enabled: true +Performance/RedundantEqualityComparisonBlock: + Enabled: true +Performance/RedundantSortBlock: + Enabled: true +Performance/RedundantSplitRegexpArgument: + Enabled: true +Performance/RedundantStringChars: + Enabled: true +Performance/ReverseFirst: + Enabled: true +Performance/SortReverse: + Enabled: true +Performance/Squeeze: + Enabled: true +Performance/StringIdentifierArgument: + Enabled: true +Performance/StringInclude: + Enabled: true +Performance/Sum: + Enabled: true + # Enable pending rubocop-rspec cops. RSpec/BeEmpty: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 674defb9..2f4c4474 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,7 +14,7 @@ module SpecHelper Dir .glob(File.expand_path(spec_helper_glob, __dir__)) .sort - .each(&method(:require)) + .each { |file| require file } RSpec.configure do |config| # Set metadata so smoke tests are run on all cop specs