Sha256: d4d9448910ca74abf676c53bda41703fe00734d3f4ddb7b4270ce8974fa20d5f

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 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 < Base
        extend AutoCorrector
        include EmptyLineSeparation

        MSG = 'Add an empty line after `%<hook>s`.'

        def on_block(node)
          return unless hook?(node)

          missing_separating_line_offense(node) do |method|
            format(MSG, hook: method)
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 18 versions & 2 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.12.1 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.12.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.11.1 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.11.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.10.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.9.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.8.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.7.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.6.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.5.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.4.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.3.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.2.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.1.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.0.1 lib/rubocop/cop/rspec/empty_line_after_hook.rb
rubocop-rspec-2.0.0 lib/rubocop/cop/rspec/empty_line_after_hook.rb