class RuboCop::Cop::Style::BarePercentLiterals

def check(node)

def check(node)
  return if node.loc.respond_to?(:heredoc_body)
  return unless node.loc.respond_to?(:begin)
  return unless node.loc.begin
  msg = case node.loc.begin.source
        when /^%[^\w]/
          format(MSG, 'Q', '') if style == :percent_q
        when /^%Q/
          format(MSG, '', 'Q') if style == :bare_percent
        end
  add_offense(node, :begin, msg) if msg
end