Skip to content

Commit

Permalink
Bump RuboCop Rspec to 2.5
Browse files Browse the repository at this point in the history
This commit bumps RuboCop Rspec to 2.5 and suppresses
the new `RSpec/ExcessiveDocstringSpacing` offenses.
  • Loading branch information
koic committed Sep 22, 2021
1 parent 7fe8ae0 commit 78943de
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -10,7 +10,7 @@ gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.7'
gem 'rubocop-performance', '~> 1.11.0'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-rspec', '~> 2.3.0'
gem 'rubocop-rspec', '~> 2.5.0'
# Workaround for cc-test-reporter with SimpleCov 0.18.
# Stop upgrading SimpleCov until the following issue will be resolved.
# https://github.com/codeclimate/test-reporter/issues/418
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cli/auto_gen_config_spec.rb
Expand Up @@ -200,7 +200,7 @@ def f
end
end

context 'when .rubocop.yml has Layout/LineLength disabled ' do
context 'when .rubocop.yml has Layout/LineLength disabled' do
let(:line_length_max) { 90 }
let(:line_length_enabled) { false }

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/config_loader_spec.rb
Expand Up @@ -1462,7 +1462,7 @@ def self.inject!
)
end

it 'loads configuration properly when it includes non-ascii characters ' do
it 'loads configuration properly when it includes non-ascii characters' do
create_file(configuration_path, <<~YAML)
# All these cops of mine are ❤
Style/Encoding:
Expand Down
Expand Up @@ -75,7 +75,7 @@
end
end

it 'does not register an offense when `#message` with another node is passed' do
it 'does not register an offense when `#message` with another node is passed' do
expect_no_offenses(<<~RUBY, 'example_cop.rb')
add_offense(node, message: message(other_node))
RUBY
Expand Down
Expand Up @@ -298,7 +298,7 @@
end

context 'double incorrect case' do
it 'detects ' do
it 'detects' do
expect_offense(<<~RUBY)
foo(<<-SQL, <<-NOSQL
foo
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/layout/line_length_spec.rb
Expand Up @@ -1087,7 +1087,7 @@ def baz(bar)
end
end

context 'semicolons inside string literal' do
context 'semicolons inside string literal' do
it 'adds offense and autocorrects elsewhere' do
expect_offense(<<~RUBY)
"00000000000000000;0000000000000000000'000000;00000'0000;0000;000"
Expand Down
Expand Up @@ -22,7 +22,7 @@
expect_no_offenses('puts()')
end

it 'ignores calls with a multiline empty brace ' do
it 'ignores calls with a multiline empty brace' do
expect_no_offenses(<<~RUBY)
puts(
)
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/lint/raise_exception_spec.rb
Expand Up @@ -69,7 +69,7 @@
RUBY
end

it 'registers an offense and corrects for `raise` with `Exception.new(args*)` ' do
it 'registers an offense and corrects for `raise` with `Exception.new(args*)`' do
expect_offense(<<~RUBY)
raise Exception.new('arg1', 'arg2')
^^^^^^^^^ Use `StandardError` over `Exception`.
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/lint/shadowed_exception_spec.rb
Expand Up @@ -85,7 +85,7 @@ def foo
RUBY
end

it 'registers an offense rescuing exceptions that are ancestors of each other ' do
it 'registers an offense rescuing exceptions that are ancestors of each other' do
expect_offense(<<~RUBY)
def
something
Expand Down
9 changes: 3 additions & 6 deletions spec/rubocop/cop/lint/useless_access_modifier_spec.rb
Expand Up @@ -815,8 +815,7 @@ def method1
end

context 'inside a class' do
it 'registers an offense when a modifier is ouside the block and a ' \
'method is defined only inside the block' do
it 'registers an offense when a modifier is ouside the block and a method is defined only inside the block' do
expect_offense(<<~RUBY, modifier: modifier)
class A
%{modifier}
Expand All @@ -829,8 +828,7 @@ def method1
RUBY
end

it 'registers two offenses when a modifier is inside and outside the ' \
' block and no method is defined' do
it 'registers two offenses when a modifier is inside and outside the block and no method is defined' do
expect_offense(<<~RUBY, modifier: modifier)
class A
%{modifier}
Expand Down Expand Up @@ -901,8 +899,7 @@ def method1
RUBY
end

it 'registers two offenses when a modifier is inside and outside the ' \
' and no method is defined' do
it 'registers two offenses when a modifier is inside and outside the and no method is defined' do
expect_offense(<<~RUBY, modifier: modifier)
class A
%{modifier}
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/lint/useless_assignment_spec.rb
Expand Up @@ -569,8 +569,8 @@ def some_method(flag)
end
end

context 'when a variable is reassigned and unreferenced in a if branch ' \
'while the variable is referenced in the paired else branch ' do
context 'when a variable is reassigned and unreferenced in a if branch' \
' while the variable is referenced in the paired else branch' do
it 'registers an offense for the reassignment in the if branch' do
expect_offense(<<~RUBY)
def some_method(flag)
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/naming/method_name_spec.rb
Expand Up @@ -150,7 +150,7 @@ def base.Start(aws_env, *args)
RUBY
end

it 'does not register an offense for camel case method name matching `IgnoredPatterns`' do
it 'does not register an offense for camel case method name matching `IgnoredPatterns`' do
expect_no_offenses(<<~RUBY)
def onSelectionBulkChange(arg)
end
Expand All @@ -165,7 +165,7 @@ def onSelectionBulkChange(arg)
RUBY
end

it 'does not register an offense for snake case method name matching `IgnoredPatterns`' do
it 'does not register an offense for snake case method name matching `IgnoredPatterns`' do
expect_no_offenses(<<~RUBY)
def on_selection_cleared(arg)
end
Expand Down
Expand Up @@ -704,7 +704,7 @@
RUBY
end

it "registers an offense for assignment using #{assignment} in case when" do
it "registers an offense for assignment using #{assignment} in case when" do
expect_offense(<<~RUBY)
case foo
^^^^^^^^ Use the return of the conditional for variable assignment and comparison.
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/style/empty_literal_spec.rb
Expand Up @@ -123,7 +123,7 @@
end
end

it 'auto-corrects Hash.new in block ' do
it 'auto-corrects Hash.new in block' do
expect_offense(<<~RUBY)
puts { Hash.new }
^^^^^^^^ Use hash literal `{}` instead of `Hash.new`.
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/style/eval_with_location_spec.rb
Expand Up @@ -96,7 +96,7 @@
RUBY
end

it 'registers an offense when using `#eval` with a string on a new line ' do
it 'registers an offense when using `#eval` with a string on a new line' do
expect_offense(<<~RUBY)
eval('puts 42',
binding,
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/style/hash_conversion_spec.rb
Expand Up @@ -67,7 +67,7 @@
RUBY
end

it 'registers and corrects an offense when using multi-argument `Hash[]` as a method argument' do
it 'registers and corrects an offense when using multi-argument `Hash[]` as a method argument' do
expect_offense(<<~RUBY)
do_something Hash[a, b, c, d], arg
^^^^^^^^^^^^^^^^ Prefer literal hash to Hash[arg1, arg2, ...].
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/style/inverse_methods_spec.rb
Expand Up @@ -299,7 +299,7 @@ def test_method
RUBY
end

it 'corrects an inverted method call when using `BasicObject# !`' do
it 'corrects an inverted method call when using `BasicObject#!` with spaces before the method call' do
expect_offense(<<~RUBY, method: method)
foo.%{method} { |e| e.bar?. ! }
^^^^^{method}^^^^^^^^^^^^^^^^^^^ Use `#{inverse}` instead of inverting `#{method}`.
Expand Down
Expand Up @@ -48,7 +48,7 @@
end

context 'assignment to a variable with the same name' do
it 'accepts parens in local variable assignment ' do
it 'accepts parens in local variable assignment' do
expect_no_offenses('test = test()')
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/style/redundant_freeze_spec.rb
Expand Up @@ -45,7 +45,7 @@
it_behaves_like 'mutable objects', "ENV['foo']"
it_behaves_like 'mutable objects', "::ENV['foo']"

it 'allows .freeze on method call' do
it 'allows .freeze on method call' do
expect_no_offenses('TOP_TEST = Something.new.freeze')
end

Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/style/redundant_parentheses_spec.rb
Expand Up @@ -381,13 +381,13 @@ def x
end

context 'when the first argument in a method call begins with a hash literal' do
it 'accepts parentheses if the argument list is not parenthesized ' do
it 'accepts parentheses if the argument list is not parenthesized' do
expect_no_offenses('x ({ y: 1 }), z')
expect_no_offenses('x ({ y: 1 }.merge({ y: 2 })), z')
expect_no_offenses('x ({ y: 1 }.merge({ y: 2 }).merge({ y: 3 })), z')
end

it 'registers an offense if the argument list is parenthesized ' do
it 'registers an offense if the argument list is parenthesized' do
expect_offense(<<~RUBY)
x(({ y: 1 }), z)
^^^^^^^^^^ Don't use parentheses around a literal.
Expand Down
3 changes: 1 addition & 2 deletions spec/rubocop/cop/style/safe_navigation_spec.rb
Expand Up @@ -917,8 +917,7 @@ def foobar
RUBY
end

it 'registers an offense for an object check followed by ' \
'a method calls that nil responds to ' do
it 'registers an offense for an object check followed by a method calls that nil responds to' do
expect_offense(<<~RUBY, variable: variable)
%{variable} && %{variable}.to_i
^{variable}^^^^^{variable}^^^^^ Use safe navigation (`&.`) instead [...]
Expand Down
7 changes: 3 additions & 4 deletions spec/rubocop/cop/style/sole_nested_conditional_spec.rb
Expand Up @@ -216,8 +216,7 @@ def foo
RUBY
end

it 'registers an offense and corrects when using `||` in the outer condition' \
'and nested modifier condition ' do
it 'registers an offense and corrects when using `||` in the outer condition and nested modifier condition' do
expect_offense(<<~RUBY)
if foo || bar
do_something if baz || qux
Expand All @@ -233,7 +232,7 @@ def foo
end

it 'registers an offense and corrects when using `unless` and `||` and parens in the outer condition' \
'and nested modifier condition ' do
' and nested modifier condition' do
expect_offense(<<~RUBY)
unless (foo || bar)
do_something if baz
Expand All @@ -249,7 +248,7 @@ def foo
end

it 'registers an offense and corrects when using `unless` and `||` without parens in the outer condition' \
'and nested modifier condition ' do
' and nested modifier condition' do
expect_offense(<<~RUBY)
unless foo || bar
do_something if baz
Expand Down
3 changes: 1 addition & 2 deletions spec/rubocop/cop/style/trailing_underscore_variable_spec.rb
Expand Up @@ -13,8 +13,7 @@
RUBY
end

it 'registers an offense when multiple underscores are used '\
'as the last variables of parallel assignment ' do
it 'registers an offense when multiple underscores are used as the last variables of parallel assignment' do
expect_offense(<<~RUBY)
a, _, _ = foo()
^^^^^ Do not use trailing `_`s in parallel assignment. Prefer `a, = foo()`.
Expand Down

0 comments on commit 78943de

Please sign in to comment.