Class: RuboCop::Cop::Gusto::Graphql::TypeVariables

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/gusto/graphql/type_variables.rb

Constant Summary collapse

MSG =
"`type_member` and `type_template` in GraphQL objects must not be untyped. " \
"The type here should match the type expected from the `object` method."
UNTYPED_OBJECT =
RuboCop::AST::NodePattern.new("  (block (send nil? {:type_member | :type_template}) (args) (hash (pair (sym :fixed) (send (const nil? :T) :untyped))))\n")

Instance Method Summary collapse

Instance Method Details

#on_block(node) ⇒ Object Also known as: on_numblock, on_itblock



15
16
17
18
19
# File 'lib/rubocop/cop/gusto/graphql/type_variables.rb', line 15

def on_block(node)
  return unless UNTYPED_OBJECT.match(node)

  add_offense(node)
end