class Querly::CLI::Formatter::Text

Public Instance Methods

config_error(path, error) click to toggle source
# File lib/querly/cli/formatter.rb, line 40
def config_error(path, error)
  STDERR.puts Rainbow("Failed to load configuration: #{path}").red
  STDERR.puts error
  STDERR.puts "Backtrace:"
  STDERR.puts format_backtrace(error.backtrace)
end
issue_found(script, rule, pair) click to toggle source
# File lib/querly/cli/formatter.rb, line 57
def issue_found(script, rule, pair)
  path = script.path.to_s
  src = Rainbow(pair.node.loc.expression.source.split(/\n/).first).red
  line = pair.node.loc.first_line
  col = pair.node.loc.column
  message = rule.messages.first.split(/\n/).first

  STDOUT.puts "#{path}:#{line}:#{col}\t#{src}\t#{message} (#{rule.id})"
end
script_error(path, error) click to toggle source
# File lib/querly/cli/formatter.rb, line 47
def script_error(path, error)
  STDERR.puts Rainbow("Failed to load script: #{path}").red

  if error.is_a? Parser::SyntaxError
    STDERR.puts error.diagnostic.render
  else
    STDERR.puts error.inspect
  end
end