Sha256: f1474acf8b71b782acc88c2823209542cc8ebff529dbe39b5c8dd6750305bd96

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      # Checks if there is an empty line after example group blocks.
      #
      # @example
      #   # bad
      #   RSpec.describe Foo do
      #     describe '#bar' do
      #     end
      #     describe '#baz' do
      #     end
      #   end
      #
      #   # good
      #   RSpec.describe Foo do
      #     describe '#bar' do
      #     end
      #
      #     describe '#baz' do
      #     end
      #   end
      #
      class EmptyLineAfterExampleGroup < Cop
        include RuboCop::RSpec::BlankLineSeparation

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

        def on_block(node)
          return unless example_group?(node)
          return if last_child?(node)

          missing_separating_line(node) do |location|
            add_offense(
              node,
              location: location,
              message: format(MSG, example_group: node.method_name)
            )
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubocop-rspec-1.41.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.40.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.39.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.38.1 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.38.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.37.1 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.37.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.36.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.35.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.34.1 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.34.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb
rubocop-rspec-1.33.0 lib/rubocop/cop/rspec/empty_line_after_example_group.rb