class CC::Analyzer::Formatters::Formatter

Constants

InvalidFormatterError

Attributes

current_engine[R]

Public Class Methods

new(filesystem, output = $stdout) click to toggle source
# File lib/cc/analyzer/formatters/formatter.rb, line 5
def initialize(filesystem, output = $stdout)
  @filesystem = filesystem
  @output = output
end

Public Instance Methods

close() click to toggle source
# File lib/cc/analyzer/formatters/formatter.rb, line 39
def close
end
engine_running(engine) { || ... } click to toggle source
# File lib/cc/analyzer/formatters/formatter.rb, line 29
def engine_running(engine)
  @current_engine = engine
  yield
ensure
  @current_engine = nil
end
failed(_output) click to toggle source
# File lib/cc/analyzer/formatters/formatter.rb, line 42
def failed(_output)
end
finished() click to toggle source
# File lib/cc/analyzer/formatters/formatter.rb, line 36
def finished
end
started() click to toggle source
# File lib/cc/analyzer/formatters/formatter.rb, line 26
def started
end
write(data) click to toggle source
# File lib/cc/analyzer/formatters/formatter.rb, line 10
def write(data)
  json = JSON.parse(data)
  json["engine_name"] = current_engine.name

  case json["type"].downcase
  when "issue"
    issues << json
  when "warning"
    warnings << json
  when "measurement"
    measurements << json
  else
    raise "Invalid type found: #{json["type"]}"
  end
end