class GraphQL::Rubocop::GraphQL::RootTypesInBlock
Identify (and auto-correct) any root types in your schema file.
Examples
Example: # bad, immediately causes Rails to load app/graphql/types/query.rb
query Types::Query # good, defers loading until the file is needed query { Types::Query }
Constants
- MSG
Public Instance Methods
Source
# File lib/graphql/rubocop/graphql/root_types_in_block.rb, line 29 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