Sha256: 8e49a2e523017640cd0bbcb9a5d2bfbbcf42bfec084ba604aed805f070cf0574
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 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 extend AutoCorrector include RuboCop::RSpec::BlankLineSeparation MSG = 'Add an empty line after `%<hook>s`.' def on_block(node) return unless hook?(node) return if last_child?(node) missing_separating_line(node) do |location| msg = format(MSG, hook: node.method_name) add_offense(location, message: msg) do |corrector| corrector.insert_after(location.end, "\n") end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rspec-1.42.0 | lib/rubocop/cop/rspec/empty_line_after_hook.rb |