Skip to content

Commit

Permalink
Suppress Layout/LineEndStringConcatenationIndentation warn
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Jun 23, 2021
1 parent faf63a9 commit 377d270
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 32 deletions.
3 changes: 1 addition & 2 deletions lib/rubocop/cop/rails/environment_comparison.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class EnvironmentComparison < Base

MSG = 'Favor `%<bang>sRails.env.%<env>s?` over `%<source>s`.'

SYM_MSG = 'Do not compare `Rails.env` with a symbol, it will always ' \
'evaluate to `false`.'
SYM_MSG = 'Do not compare `Rails.env` with a symbol, it will always evaluate to `false`.'

RESTRICT_ON_SEND = %i[== !=].freeze

Expand Down
3 changes: 1 addition & 2 deletions lib/rubocop/cop/rails/inverse_of.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ module Rails
# @see https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses
class InverseOf < Base
SPECIFY_MSG = 'Specify an `:inverse_of` option.'
NIL_MSG = 'You specified `inverse_of: nil`, you probably meant to ' \
'use `inverse_of: false`.'
NIL_MSG = 'You specified `inverse_of: nil`, you probably meant to use `inverse_of: false`.'
RESTRICT_ON_SEND = %i[has_many has_one belongs_to].freeze

def_node_matcher :association_recv_arguments, <<~PATTERN
Expand Down
6 changes: 2 additions & 4 deletions spec/rubocop/cop/rails/assert_not_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
RUBY
end

it 'registers an offense and corrects using `assert !` ' \
'with a failure message' do
it 'registers an offense and corrects using `assert !` with a failure message' do
expect_offense(<<~RUBY)
assert !foo, 'a failure message'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `assert_not` over `assert !`.
Expand All @@ -24,8 +23,7 @@
RUBY
end

it 'registers an offense and corrects using `assert !` ' \
'with a more complex value' do
it 'registers an offense and corrects using `assert !` with a more complex value' do
expect_offense(<<~RUBY)
assert !foo.bar(baz)
^^^^^^^^^^^^^^^^^^^^ Prefer `assert_not` over `assert !`.
Expand Down
3 changes: 1 addition & 2 deletions spec/rubocop/cop/rails/exit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
expect_no_offenses('Object.new.exit')
end

it 'does not register an offense for an explicit exit call '\
'with an argument on an object' do
it 'does not register an offense for an explicit exit call with an argument on an object' do
expect_no_offenses('Object.new.exit(0)')
end

Expand Down
3 changes: 1 addition & 2 deletions spec/rubocop/cop/rails/find_each_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
end

it "does not register an offense when using #{scope}.select(...).each" do
expect_no_offenses("User.#{scope}.select(:name, :age).each " \
'{ |u| u.something }')
expect_no_offenses("User.#{scope}.select(:name, :age).each { |u| u.something }")
end
end

Expand Down
9 changes: 3 additions & 6 deletions spec/rubocop/cop/rails/http_positional_arguments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@
end

%w[get post patch put head delete].each do |keyword|
it 'does not register an offense when keyword is used ' \
'in a chained method call' do
it 'does not register an offense when keyword is used in a chained method call' do
expect_no_offenses("@user.#{keyword}.id = ''")
end
end
Expand Down Expand Up @@ -349,8 +348,7 @@
RUBY
end

it 'auto-corrects http action when parameter matches ' \
'special keyword name' do
it 'auto-corrects http action when parameter matches special keyword name' do
expect_offense(<<~RUBY)
post :create, id: 7, comment: { body: "hei" }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use keyword arguments instead of positional arguments for http call: `post`.
Expand Down Expand Up @@ -385,8 +383,7 @@
RUBY
end

it 'auto-corrects http action when params and action name ' \
'are method calls' do
it 'auto-corrects http action when params and action name are method calls' do
expect_offense(<<~RUBY)
post user_attrs, params
^^^^^^ Use keyword arguments instead of positional arguments for http call: `post`.
Expand Down
3 changes: 1 addition & 2 deletions spec/rubocop/cop/rails/link_to_blank_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
RUBY
end

it 'autocorrects with a new rel when using a symbol for the target \
value' do
it 'autocorrects with a new rel when using a symbol for the target value' do
new_source = autocorrect_source(<<~RUBY)
link_to 'Click here', 'https://www.example.com', target: :_blank
RUBY
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Rails::RedundantReceiverInWithOptions, :config do
it 'registers an offense and corrects using explicit receiver ' \
'in `with_options`' do
it 'registers an offense and corrects using explicit receiver in `with_options`' do
expect_offense(<<~RUBY)
class Account < ApplicationRecord
with_options dependent: :destroy do |assoc|
Expand Down
16 changes: 10 additions & 6 deletions spec/rubocop/cop/rails/save_bang_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -595,15 +595,19 @@ def whatever

shared_examples 'checks_create_offense' do |method|
it "when using persisted? after #{method}" do
expect_no_offenses("x = object.#{method}\n" \
'if x.persisted? then; something; end')
expect_no_offenses(<<~RUBY)
x = object.#{method}
if x.persisted? then; something; end
RUBY
end

it "when using persisted? after #{method} with block" do
expect_no_offenses("x = object.#{method} do |obj|\n" \
" obj.name = 'Tom'\n" \
"end\n" \
'if x.persisted? then; something; end')
expect_no_offenses(<<~RUBY)
x = object.#{method} do |obj|
obj.name = 'Tom'
end
if x.persisted? then; something; end
RUBY
end

it "when using persisted? after #{method} called on a chain" do
Expand Down
3 changes: 1 addition & 2 deletions spec/rubocop/cop/rails/time_zone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
RUBY
end

it 'does not register an offense when a .new method is called
independently of the Time class' do
it 'does not register an offense when a .new method is called independently of the Time class' do
expect_no_offenses(<<~RUBY)
Range.new(1, Time.class.to_s)
RUBY
Expand Down
3 changes: 1 addition & 2 deletions tasks/cops_documentation.rake
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ task verify_cops_documentation: :generate_cops_documentation do
# Output diff before raising error
sh('GIT_PAGER=cat git diff docs')

warn 'The docs directory is out of sync. ' \
'Run `rake generate_cops_documentation` and commit the results.'
warn 'The docs directory is out of sync. Run `rake generate_cops_documentation` and commit the results.'
exit!
end
end
Expand Down

0 comments on commit 377d270

Please sign in to comment.