Sha256: cc770289693d13eda9eb0ce04df433882cdeb50c8359881d5b1364eb9828ce54

Contents?: true

Size: 815 Bytes

Versions: 175

Compression:

Stored size: 815 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Layout
      # Checks if empty lines around the bodies of blocks match
      # the configuration.
      #
      # @example EnforcedStyle: no_empty_lines (default)
      #   # good
      #
      #   foo do |bar|
      #     # ...
      #   end
      #
      # @example EnforcedStyle: empty_lines
      #   # good
      #
      #   foo do |bar|
      #
      #     # ...
      #
      #   end
      class EmptyLinesAroundBlockBody < Base
        include EmptyLinesAroundBody
        extend AutoCorrector

        KIND = 'block'

        def on_block(node)
          first_line = node.send_node.last_line

          check(node, node.body, adjusted_first_line: first_line)
        end

        alias on_numblock on_block
      end
    end
  end
end

Version data entries

175 entries across 170 versions & 17 rubygems

Version Path
rubocop-1.68.0 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.67.0 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.66.1 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.66.0 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.65.1 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.65.0 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/layout/empty_lines_around_block_body.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/layout/empty_lines_around_block_body.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/layout/empty_lines_around_block_body.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-1.64.1/lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.64.1 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.63.4 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.63.3 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.63.2 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.63.1 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.63.0 lib/rubocop/cop/layout/empty_lines_around_block_body.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.62.1/lib/rubocop/cop/layout/empty_lines_around_block_body.rb
rubocop-1.62.1 lib/rubocop/cop/layout/empty_lines_around_block_body.rb