Sha256: 86e47875f868f1c674060a93dc46075f158f0cd22899f0729eb5cea7a5467383
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Checks if there is an empty line after the last let block. # # @example # # bad # let(:foo) { bar } # let(:something) { other } # it { does_something } # # # good # let(:foo) { bar } # let(:something) { other } # # it { does_something } class EmptyLineAfterFinalLet < Cop include RuboCop::RSpec::BlankLineSeparation MSG = 'Add an empty line after the last `let` block.'.freeze def_node_matcher :let?, Helpers::ALL.block_pattern 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 latest_let.equal?(node.body.children.last) missing_separating_line(latest_let) do |location| add_offense(latest_let, location: location) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rspec-1.27.0 | lib/rubocop/cop/rspec/empty_line_after_final_let.rb |