Class: RuboCop::Cop::GraphQL::Heredoc

Inherits:
RuboCop::Cop show all
Defined in:
lib/rubocop/cop/graphql/heredoc.rb

Overview

Public: Cop for enforcing non-interpolated GRAPHQL heredocs.

Instance Method Summary collapse

Instance Method Details

#on_str(node) ⇒ Object



8
9
10
11
12
13
# File 'lib/rubocop/cop/graphql/heredoc.rb', line 8

def on_str(node)
  return unless node.location.is_a?(Parser::Source::Map::Heredoc)
  return unless node.location.expression.source == "<<-GRAPHQL"

  add_offense(node, :expression, "GraphQL heredocs should be quoted. <<-'GRAPHQL'")
end