Skip to content

Commit

Permalink
Suppress new Style/RedundantHeredocDelimiterQuotes cop's offenses
Browse files Browse the repository at this point in the history
Follow up rubocop/rubocop#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
```
  • Loading branch information
koic committed Feb 1, 2023
1 parent d6a39e9 commit fd69f79
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions spec/rubocop/cop/rails/helper_instance_variable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ 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
RUBY
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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rails/match_route_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/rails/reflection_class_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rails/root_pathname_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd69f79

Please sign in to comment.