Sha256: 66197611c957369803f4e9f1b36786019150cde5c2d3a32621ff0988f763c907

Contents?: true

Size: 866 Bytes

Versions: 10

Compression:

Stored size: 866 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 methods match
      # the configuration.
      #
      # @example
      #
      #   def something(arg)
      #
      #     ...
      #   end
      #
      class EmptyLinesAroundMethodBody < Cop
        include EmptyLinesAroundBody
        include OnMethodDef

        KIND = 'method'.freeze

        private

        def on_method_def(node, _method_name, _args, body)
          check(node, body)
        end

        # Override ConfigurableEnforcedStyle#style and hard-code
        # configuration. It's difficult to imagine that anybody would want
        # empty lines around a method body, so we don't make it configurable.
        def style
          :no_empty_lines
        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_method_body.rb
rubocop-0.41.1 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.41.0 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.40.0 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.39.0 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.38.0 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.37.2 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.37.1 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.37.0 lib/rubocop/cop/style/empty_lines_around_method_body.rb
rubocop-0.36.0 lib/rubocop/cop/style/empty_lines_around_method_body.rb