lib/rubocop/cop/layout/class_structure.rb in rubocop-0.84.0 vs lib/rubocop/cop/layout/class_structure.rb in rubocop-0.85.0

- old
+ new

@@ -6,26 +6,28 @@ # Checks if the code style follows the ExpectedOrder configuration: # # `Categories` allows us to map macro names into a category. # # Consider an example of code style that covers the following order: - # - Module inclusion (include, prepend, extend) - # - Constants - # - Associations (has_one, has_many) - # - Public attribute macros (attr_accessor, attr_writer, attr_reader) - # - Other macros (validates, validate) - # - Public class methods - # - Initializer - # - Public instance methods - # - Protected attribute macros (attr_accessor, attr_writer, attr_reader) - # - Protected instance methods - # - Private attribute macros (attr_accessor, attr_writer, attr_reader) - # - Private instance methods # + # * Module inclusion (include, prepend, extend) + # * Constants + # * Associations (has_one, has_many) + # * Public attribute macros (attr_accessor, attr_writer, attr_reader) + # * Other macros (validates, validate) + # * Public class methods + # * Initializer + # * Public instance methods + # * Protected attribute macros (attr_accessor, attr_writer, attr_reader) + # * Protected instance methods + # * Private attribute macros (attr_accessor, attr_writer, attr_reader) + # * Private instance methods + # # You can configure the following order: # - # ```yaml + # [source,yaml] + # ---- # Layout/ClassStructure: # ExpectedOrder: # - module_inclusion # - constants # - association @@ -38,17 +40,18 @@ # - protected_attribute_macros # - protected_methods # - private_attribute_macros # - private_delegate # - private_methods - # ``` + # ---- # # Instead of putting all literals in the expected order, is also # possible to group categories of macros. Visibility levels are handled # automatically. # - # ```yaml + # [source,yaml] + # ---- # Layout/ClassStructure: # Categories: # association: # - has_many # - has_one @@ -61,10 +64,10 @@ # - validate # module_inclusion: # - include # - prepend # - extend - # ``` + # ---- # # @example # # bad # # Expect extend be before constant # class Person < ApplicationRecord