Sha256: d8608c1185435899c6e10aee4e23c9f61157f886059a904957dcaab8918fa68d
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Checks if there is an empty line after hook blocks. # # @example # # bad # before { do_something } # it { does_something } # # # bad # after { do_something } # it { does_something } # # # bad # around { |test| test.run } # it { does_something } # # # good # before { do_something } # # it { does_something } # # # good # after { do_something } # # it { does_something } # # # good # around { |test| test.run } # # it { does_something } # class EmptyLineAfterHook < Cop include RuboCop::RSpec::BlankLineSeparation MSG = 'Add an empty line after `%<hook>s`.'.freeze def_node_matcher :hook?, Hooks::ALL.block_pattern def on_block(node) return unless hook?(node) return if node.equal?(node.parent.children.last) missing_separating_line(node) do |location| add_offense( node, location: location, message: format(MSG, hook: node.method_name) ) 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_hook.rb |