Sha256: 8f1653faeba9c626a339e445c3cd6afa301ccf09986a343a330ed0b02817a280
Contents?: true
Size: 1002 Bytes
Versions: 62
Compression:
Stored size: 1002 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for trailing code after the class definition. # # @example # # bad # class Foo; def foo; end # end # # # good # class Foo # def foo; end # end # class TrailingBodyOnClass < Cop include Alignment include TrailingBody MSG = 'Place the first line of class body on its own line.' def on_class(node) return unless trailing_body?(node) add_offense(node, location: first_part_of(node.to_a.last)) end def autocorrect(node) lambda do |corrector| LineBreakCorrector.correct_trailing_body( configured_width: configured_indentation_width, corrector: corrector, node: node, processed_source: processed_source ) end end end end end end
Version data entries
62 entries across 43 versions & 5 rubygems