Sha256: eb7d3e5b05147edd1d7f4002a820b7208ed71e7b39842cc20cf2cc7a78d9303d
Contents?: true
Size: 997 Bytes
Versions: 7
Compression:
Stored size: 997 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Checks if there is an empty line after subject block. # # @example # # bad # subject(:obj) { described_class } # let(:foo) { bar } # # # good # subject(:obj) { described_class } # # let(:foo) { bar } class EmptyLineAfterSubject < Cop include RuboCop::RSpec::BlankLineSeparation MSG = 'Add empty line after `subject`.'.freeze def on_block(node) return unless subject?(node) && !in_spec_block?(node) return if last_child?(node) missing_separating_line(node) do |location| add_offense(node, location: location, message: MSG) end end private def in_spec_block?(node) node.each_ancestor(:block).any? do |ancestor| Examples::ALL.include?(ancestor.method_name) end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems