Module: RuboCop::Cop::Style::RbsInline::DataClassMatcher

Included in:
DataClassCommentAlignment, DataDefineWithBlock, MissingDataClassAnnotation
Defined in:
lib/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rb,
sig/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rbs

Overview

Matcher for Data.define calls, shared by the cops that check Data.define class definitions.

Instance Method Summary collapse

Instance Method Details

#struct_like_class?(node) ⇒ Boolean

Parameters:

  • node (RuboCop::AST::SendNode)

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rb', line 13

def struct_like_class?(node) #: bool
  return false unless node.method_name == :define

  (r = node.receiver).is_a?(RuboCop::AST::ConstNode) && r.short_name == :Data
end