Class: RuboCop::Cop::RSpec::EmptyLineAfterFinalLet
- Includes:
- RSpec::BlankLineSeparation
- Defined in:
- lib/rubocop/cop/rspec/empty_line_after_final_let.rb
Overview
Checks if there is an empty line after the last let block.
Constant Summary collapse
- MSG =
'Add an empty line after the last `let` block.'
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
RSpec::Language::ALL, RSpec::Language::RSPEC
Instance Method Summary collapse
Methods included from RSpec::BlankLineSeparation
#autocorrect, #last_child?, #missing_separating_line, #offending_loc
Methods included from RSpec::FinalEndLocation
Methods inherited from Cop
Instance Method Details
#on_block(node) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubocop/cop/rspec/empty_line_after_final_let.rb', line 24 def on_block(node) return unless example_group_with_body?(node) latest_let = node.body.child_nodes.select { |child| let?(child) }.last return if latest_let.nil? return if last_child?(latest_let) (latest_let) do |location| add_offense(latest_let, location: location) end end |