Skip to content

Commit 5928b3d

Browse files
authored
Merge pull request #1305 from rubocop/pass-range-as-a-positional-argument-in-range_help-range_with_surrounding_space
Pass range as a positional arg
2 parents 02cbb08 + dae0004 commit 5928b3d

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

lib/rubocop/cop/rspec/empty_hook.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ class EmptyHook < Base
3636
def on_block(node)
3737
empty_hook?(node) do |hook|
3838
add_offense(hook) do |corrector|
39-
range = range_with_surrounding_space(
40-
range: node.loc.expression,
41-
side: :left
39+
corrector.remove(
40+
range_with_surrounding_space(node.loc.expression, side: :left)
4241
)
43-
corrector.remove(range)
4442
end
4543
end
4644
end

lib/rubocop/cop/rspec/focus.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ def focus_metadata(node, &block)
6969
end
7070

7171
def with_surrounding(focus)
72-
range_with_space = range_with_surrounding_space(
73-
range: focus.loc.expression,
74-
side: :left
75-
)
72+
range_with_space =
73+
range_with_surrounding_space(focus.loc.expression, side: :left)
7674

7775
range_with_surrounding_comma(range_with_space, :left)
7876
end

lib/rubocop/cop/rspec/yield.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def on_block(node)
4444

4545
def autocorrect(corrector, node, range)
4646
corrector.replace(
47-
range_with_surrounding_space(range: range, side: :left),
47+
range_with_surrounding_space(range, side: :left),
4848
generate_replacement(node.body)
4949
)
5050
end

rubocop-rspec.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
3737
'rubygems_mfa_required' => 'true'
3838
}
3939

40-
spec.add_runtime_dependency 'rubocop', '~> 1.19'
40+
spec.add_runtime_dependency 'rubocop', '~> 1.31'
4141

4242
spec.add_development_dependency 'rack'
4343
spec.add_development_dependency 'rake'

0 commit comments

Comments
 (0)