Class: GraphQL::Rubocop::GraphQL::RootTypesInBlock
- Inherits:
 - 
      BaseCop
      
        
- Object
 - RuboCop::Cop::Base
 - BaseCop
 - GraphQL::Rubocop::GraphQL::RootTypesInBlock
 
 
- Defined in:
 - lib/graphql/rubocop/graphql/root_types_in_block.rb
 
Overview
Identify (and auto-correct) any root types in your schema file.
Constant Summary collapse
- MSG =
 "type configuration can be moved to a block to defer loading the type's file"
Instance Method Summary collapse
Methods inherited from BaseCop
#source_without_keyword_argument
Instance Method Details
#on_send(node) ⇒ Object
      25 26 27 28 29 30 31 32 33 34  | 
    
      # File 'lib/graphql/rubocop/graphql/root_types_in_block.rb', line 25 def on_send(node) root_type_config_without_block(node) do add_offense(node) do |corrector| new_node_source = node.source_range.source new_node_source.sub!(/(query|mutation|subscription)/, '\1 {') new_node_source << " }" corrector.replace(node, new_node_source) end end end  |