From fd69f79826de1e8efcd4c8c1f0f2623626df14c8 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Wed, 1 Feb 2023 18:08:45 +0900 Subject: [PATCH] Suppress new `Style/RedundantHeredocDelimiterQuotes` cop's offenses Follow up https://github.com/rubocop/rubocop/pull/11528. This commit suppresses the following new `Style/RedundantHeredocDelimiterQuotes` cop's offenses: ```console % bundle exec rake (snip) Offenses: spec/rubocop/cop/rails/helper_instance_variable_spec.rb:31:24: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_no_offenses(<<~'RUBY') ^^^^^^^^^ spec/rubocop/cop/rails/helper_instance_variable_spec.rb:39:24: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_no_offenses(<<~'RUBY') ^^^^^^^^^ spec/rubocop/cop/rails/helper_instance_variable_spec.rb:50:24: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_no_offenses(<<~'RUBY') ^^^^^^^^^ spec/rubocop/cop/rails/helper_instance_variable_spec.rb:61:20: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_offense(<<~'RUBY') ^^^^^^^^^ spec/rubocop/cop/rails/match_route_spec.rb:110:24: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_no_offenses(<<~'RUBY') ^^^^^^^^^ spec/rubocop/cop/rails/reflection_class_name_spec.rb:57:24: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_no_offenses(<<~'RUBY') ^^^^^^^^^ spec/rubocop/cop/rails/reflection_class_name_spec.rb:63:24: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_no_offenses(<<~'RUBY') ^^^^^^^^^ spec/rubocop/cop/rails/root_pathname_methods_spec.rb:123:22: C: [Correctable] Style/RedundantHeredocDelimiterQuotes: Remove the redundant heredoc delimiter quotes, use <<~RUBY instead. expect_offense(<<~'RUBY') ^^^^^^^^^ 279 files inspected, 8 offenses detected, 8 offenses autocorrectable ``` --- spec/rubocop/cop/rails/helper_instance_variable_spec.rb | 8 ++++---- spec/rubocop/cop/rails/match_route_spec.rb | 2 +- spec/rubocop/cop/rails/reflection_class_name_spec.rb | 4 ++-- spec/rubocop/cop/rails/root_pathname_methods_spec.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/rubocop/cop/rails/helper_instance_variable_spec.rb b/spec/rubocop/cop/rails/helper_instance_variable_spec.rb index 52d46c431b..0332ba7f3d 100644 --- a/spec/rubocop/cop/rails/helper_instance_variable_spec.rb +++ b/spec/rubocop/cop/rails/helper_instance_variable_spec.rb @@ -28,7 +28,7 @@ def welcome_message(user) end it 'does not register an offense when using memoization' do - expect_no_offenses(<<~'RUBY') + expect_no_offenses(<<~RUBY) def foo @cache ||= heavy_load end @@ -36,7 +36,7 @@ def foo end it 'does not register an offense when a class which inherits `ActionView::Helpers::FormBuilder`' do - expect_no_offenses(<<~'RUBY') + expect_no_offenses(<<~RUBY) class MyFormBuilder < ActionView::Helpers::FormBuilder def do_something @template @@ -47,7 +47,7 @@ def do_something end it 'does not register an offense when a class which inherits `::ActionView::Helpers::FormBuilder`' do - expect_no_offenses(<<~'RUBY') + expect_no_offenses(<<~RUBY) class MyFormBuilder < ::ActionView::Helpers::FormBuilder def do_something @template @@ -58,7 +58,7 @@ def do_something end it 'registers an offense when using a class which does not inherit `ActionView::Helpers::FormBuilder`' do - expect_offense(<<~'RUBY') + expect_offense(<<~RUBY) class Foo def do_something @template diff --git a/spec/rubocop/cop/rails/match_route_spec.rb b/spec/rubocop/cop/rails/match_route_spec.rb index 830b1af2a0..99ba6241af 100644 --- a/spec/rubocop/cop/rails/match_route_spec.rb +++ b/spec/rubocop/cop/rails/match_route_spec.rb @@ -107,7 +107,7 @@ end it 'does not register an offense when via is a variable' do - expect_no_offenses(<<~'RUBY') + expect_no_offenses(<<~RUBY) routes.draw do match ':controller/:action/:id', via: method end diff --git a/spec/rubocop/cop/rails/reflection_class_name_spec.rb b/spec/rubocop/cop/rails/reflection_class_name_spec.rb index abf5bec368..ea478b5fda 100644 --- a/spec/rubocop/cop/rails/reflection_class_name_spec.rb +++ b/spec/rubocop/cop/rails/reflection_class_name_spec.rb @@ -54,13 +54,13 @@ end it 'does not register an offense when using `class_name: do_something.to_s`' do - expect_no_offenses(<<~'RUBY') + expect_no_offenses(<<~RUBY) has_many :accounts, class_name: do_something.to_s RUBY end it 'does not register an offense when using `class_name: to_s`' do - expect_no_offenses(<<~'RUBY') + expect_no_offenses(<<~RUBY) has_many :accounts, class_name: to_s RUBY end diff --git a/spec/rubocop/cop/rails/root_pathname_methods_spec.rb b/spec/rubocop/cop/rails/root_pathname_methods_spec.rb index f92a2d67cb..709f8592b5 100644 --- a/spec/rubocop/cop/rails/root_pathname_methods_spec.rb +++ b/spec/rubocop/cop/rails/root_pathname_methods_spec.rb @@ -120,7 +120,7 @@ end it 'registers an offense when using `Rails.env` argument within `Dir.glob`' do - expect_offense(<<~'RUBY') + expect_offense(<<~RUBY) Dir.glob(Rails.root.join("db", "seeds", Rails.env, "*.rb")).sort.each do |file| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rails.root` is a `Pathname` so you can just append `#glob`. load file