Sha256: 18767e0beec24c384a8d6cf10841ffe5c2ca70191b29c1dcaef27f30c352a2d3

Contents?: true

Size: 1.64 KB

Versions: 11

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Layout
      # This cops checks if empty lines around the bodies of classes match
      # the configuration.
      #
      # @example EnforcedStyle: empty_lines
      #   # good
      #
      #   class Foo
      #
      #     def bar
      #       # ...
      #     end
      #
      #   end
      #
      # @example EnforcedStyle: empty_lines_except_namespace
      #   # good
      #
      #   class Foo
      #     class Bar
      #
      #       # ...
      #
      #     end
      #   end
      #
      # @example EnforcedStyle: empty_lines_special
      #   # good
      #   class Foo
      #
      #     def bar; end
      #
      #   end
      #
      # @example Enforcedstyle: beginning_only
      #   # good
      #
      #   class Foo
      #
      #     def bar
      #       # ...
      #     end
      #   end
      #
      # @example Enforcedstyle: ending_only
      #   # good
      #
      #   class Foo
      #     def bar
      #       # ...
      #     end
      #
      #   end
      #
      # @example EnforcedStyle: no_empty_lines (default)
      #   # good
      #
      #   class Foo
      #     def bar
      #       # ...
      #     end
      #   end
      class EmptyLinesAroundClassBody < Cop
        include EmptyLinesAroundBody

        KIND = 'class'.freeze

        def on_class(node)
          _name, _superclass, body = *node
          check(node, body)
        end

        def on_sclass(node)
          _obj, body = *node
          check(node, body)
        end

        def autocorrect(node)
          EmptyLineCorrector.correct(node)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
rubocop-0.58.2 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.58.1 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.58.0 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.57.2 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.57.1 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.57.0 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.56.0 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.55.0 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.54.0 lib/rubocop/cop/layout/empty_lines_around_class_body.rb
rubocop-0.53.0 lib/rubocop/cop/layout/empty_lines_around_class_body.rb