From 892e38c78e03c11afaa5f01d995e3a21bd92b415 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 21 Dec 2018 02:44:01 +0900 Subject: Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin block Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before. --- railties/lib/rails/all.rb | 6 ++---- railties/lib/rails/command/behavior.rb | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/all.rb b/railties/lib/rails/all.rb index f5dccd2381..b4a9c4e65f 100644 --- a/railties/lib/rails/all.rb +++ b/railties/lib/rails/all.rb @@ -13,8 +13,6 @@ require "rails" rails/test_unit/railtie sprockets/railtie ).each do |railtie| - begin - require railtie - rescue LoadError - end + require railtie +rescue LoadError end diff --git a/railties/lib/rails/command/behavior.rb b/railties/lib/rails/command/behavior.rb index 718e2d9ab2..7f32b04cf1 100644 --- a/railties/lib/rails/command/behavior.rb +++ b/railties/lib/rails/command/behavior.rb @@ -56,12 +56,10 @@ module Rails def lookup! $LOAD_PATH.each do |base| Dir[File.join(base, *file_lookup_paths)].each do |path| - begin - path = path.sub("#{base}/", "") - require path - rescue Exception - # No problem - end + path = path.sub("#{base}/", "") + require path + rescue Exception + # No problem end end end -- cgit v1.2.3