Sha256: 10fab3ceddba7bb46c4c4fbe19a6b13d788ace41a0489755e5ddaf0dd6087444

Contents?: true

Size: 832 Bytes

Versions: 10

Compression:

Stored size: 832 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module RuboCop
  module Cop
    module Style
      # This cops checks if empty lines around the bodies of blocks match
      # the configuration.
      #
      # @example
      #
      #   something do
      #
      #     ...
      #   end
      #
      class EmptyLinesAroundBlockBody < Cop
        include EmptyLinesAroundBody

        KIND = 'block'.freeze

        def on_block(node)
          _send, _args, body = *node
          check(node, body)
        end

        private

        def check(node, body)
          return unless body || style == :no_empty_lines

          start_line = node.loc.begin.line
          end_line = node.loc.end.line

          return if start_line == end_line

          check_source(start_line, end_line)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubocop-0.41.2 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.41.1 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.41.0 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.40.0 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.39.0 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.38.0 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.37.2 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.37.1 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.37.0 lib/rubocop/cop/style/empty_lines_around_block_body.rb
rubocop-0.36.0 lib/rubocop/cop/style/empty_lines_around_block_body.rb