Class: Querly::CLI::Formatter::Text
- Inherits:
-
Base
- Object
- Base
- Querly::CLI::Formatter::Text
show all
- Defined in:
- lib/querly/cli/formatter.rb
Instance Method Summary
collapse
Methods inherited from Base
#config_load, #fatal_error, #finish, #script_load, #start
#format_backtrace
Instance Method Details
#config_error(path, error) ⇒ Object
40
41
42
43
44
45
|
# 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) ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'lib/querly/cli/formatter.rb', line 52
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) ⇒ Object
47
48
49
50
|
# File 'lib/querly/cli/formatter.rb', line 47
def script_error(path, error)
STDERR.puts Rainbow("Failed to load script: #{path}").red
STDERR.puts error.inspect
end
|