Skip to content

Commit

Permalink
Merge pull request #1305 from rubocop/pass-range-as-a-positional-argu…
Browse files Browse the repository at this point in the history
…ment-in-range_help-range_with_surrounding_space

Pass range as a positional arg
  • Loading branch information
bquorning committed Jun 27, 2022
2 parents 02cbb08 + dae0004 commit 5928b3d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions lib/rubocop/cop/rspec/empty_hook.rb
Expand Up @@ -36,11 +36,9 @@ class EmptyHook < Base
def on_block(node)
empty_hook?(node) do |hook|
add_offense(hook) do |corrector|
range = range_with_surrounding_space(
range: node.loc.expression,
side: :left
corrector.remove(
range_with_surrounding_space(node.loc.expression, side: :left)
)
corrector.remove(range)
end
end
end
Expand Down
6 changes: 2 additions & 4 deletions lib/rubocop/cop/rspec/focus.rb
Expand Up @@ -69,10 +69,8 @@ def focus_metadata(node, &block)
end

def with_surrounding(focus)
range_with_space = range_with_surrounding_space(
range: focus.loc.expression,
side: :left
)
range_with_space =
range_with_surrounding_space(focus.loc.expression, side: :left)

range_with_surrounding_comma(range_with_space, :left)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rspec/yield.rb
Expand Up @@ -44,7 +44,7 @@ def on_block(node)

def autocorrect(corrector, node, range)
corrector.replace(
range_with_surrounding_space(range: range, side: :left),
range_with_surrounding_space(range, side: :left),
generate_replacement(node.body)
)
end
Expand Down
2 changes: 1 addition & 1 deletion rubocop-rspec.gemspec
Expand Up @@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
'rubygems_mfa_required' => 'true'
}

spec.add_runtime_dependency 'rubocop', '~> 1.19'
spec.add_runtime_dependency 'rubocop', '~> 1.31'

spec.add_development_dependency 'rack'
spec.add_development_dependency 'rake'
Expand Down

0 comments on commit 5928b3d

Please sign in to comment.