Module: RuboCop::GraphQL::Sorbet

Extended by:
NodePattern::Macros
Included in:
Cop::GraphQL::FieldDefinitions
Defined in:
lib/rubocop/graphql/sorbet.rb

Instance Method Summary collapse

Instance Method Details

#has_sorbet_signature?(node) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/rubocop/graphql/sorbet.rb', line 13

def has_sorbet_signature?(node)
  !!sorbet_signature_for(node)
end

#sorbet_signature(node) ⇒ Object



9
10
11
# File 'lib/rubocop/graphql/sorbet.rb', line 9

def_node_matcher(:sorbet_signature, <<~PATTERN)
  (block (send nil? :sig) (args) ...)
PATTERN

#sorbet_signature_for(node) ⇒ Object



17
18
19
20
# File 'lib/rubocop/graphql/sorbet.rb', line 17

def sorbet_signature_for(node)
  sibling = node.left_sibling
  sibling if sibling && sorbet_signature(sibling)
end