Class: RuboCop::Cop::RSpec::EmptyLineAfterHook
- Extended by:
- AutoCorrector
- Includes:
- ConfigurableEnforcedStyle, EmptyLineSeparation
- Defined in:
- lib/rubocop/cop/rspec/empty_line_after_hook.rb
Overview
Checks if there is an empty line after hook blocks.
‘AllowConsecutiveOneLiners` configures whether adjacent one-line definitions are considered an offense.
Constant Summary collapse
- MSG =
'Add an empty line after `%<hook>s`.'
Instance Method Summary collapse
- #on_block(node) ⇒ Object (also: #on_numblock)
Methods included from EmptyLineSeparation
#last_child?, #missing_separating_line, #missing_separating_line_offense, #offending_loc
Methods included from FinalEndLocation
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#on_block(node) ⇒ Object Also known as: on_numblock
60 61 62 63 64 65 66 67 68 |
# File 'lib/rubocop/cop/rspec/empty_line_after_hook.rb', line 60 def on_block(node) return unless hook?(node) return if cop_config['AllowConsecutiveOneLiners'] && chained_single_line_hooks?(node) (node) do |method| format(MSG, hook: method) end end |