lib/rubocop/cop/rspec/empty_hook.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/empty_hook.rb in rubocop-rspec-2.13.0
- old
+ new
@@ -20,10 +20,11 @@
# end
# before(:all) do
# create_feed
# end
# after(:all) { cleanup_feed }
+ #
class EmptyHook < Base
extend AutoCorrector
include RuboCop::Cop::RangeHelp
MSG = 'Empty hook detected.'
@@ -31,10 +32,10 @@
# @!method empty_hook?(node)
def_node_matcher :empty_hook?, <<~PATTERN
(block $#{send_pattern('#Hooks.all')} _ nil?)
PATTERN
- def on_block(node)
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
empty_hook?(node) do |hook|
add_offense(hook) do |corrector|
corrector.remove(
range_with_surrounding_space(node.loc.expression, side: :left)
)