Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bquorning committed Jul 9, 2020
1 parent 50a0a11 commit a233e17
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
6 changes: 2 additions & 4 deletions lib/rubocop/cop/rspec/hook_argument.rb
Expand Up @@ -93,10 +93,8 @@ def check_implicit(method_send)
style_detected(:implicit)
return if implicit_style?

add_offense(
method_send.loc.selector,
message: format(EXPLICIT_MSG, scope: style)
) do |corrector|
msg = explicit_message(nil)
add_offense(method_send.loc.selector, message: msg) do |corrector|
scope = "(#{style.inspect})"
corrector.replace(argument_range(method_send), scope)
end
Expand Down
6 changes: 2 additions & 4 deletions lib/rubocop/cop/rspec/implicit_expect.rb
Expand Up @@ -55,10 +55,8 @@ def on_send(node) # rubocop:disable Metrics/MethodLength
else
opposite_style_detected

add_offense(
source_range,
message: offense_message(expectation_source)
) do |corrector|
msg = offense_message(expectation_source)
add_offense(source_range, message: msg) do |corrector|
replacement = replacement_source(expectation_source)
corrector.replace(source_range, replacement)
end
Expand Down
12 changes: 3 additions & 9 deletions lib/rubocop/cop/rspec/return_from_stub.rb
Expand Up @@ -65,11 +65,8 @@ def on_block(node)
def check_and_return_call(node)
and_return_value(node) do |and_return, args|
unless dynamic?(args)
add_offense(
and_return.loc.selector,
message: MSG_BLOCK
) do |corrector|
AndReturnCallCorrector.new(and_return).call(corrector)
add_offense(and_return.loc.selector, message: MSG_BLOCK) do |corr|
AndReturnCallCorrector.new(and_return).call(corr)
end
end
end
Expand All @@ -78,10 +75,7 @@ def check_and_return_call(node)
def check_block_body(block)
body = block.body
unless dynamic?(body) # rubocop:disable Style/GuardClause
add_offense(
block.loc.begin,
message: MSG_AND_RETURN
) do |corrector|
add_offense(block.loc.begin, message: MSG_AND_RETURN) do |corrector|
BlockBodyCorrector.new(block).call(corrector)
end
end
Expand Down

0 comments on commit a233e17

Please sign in to comment.