Class: CC::Analyzer::Formatters::HTMLFormatter

Inherits:
Formatter
  • Object
show all
Defined in:
lib/cc/analyzer/formatters/html_formatter.rb

Defined Under Namespace

Classes: ReportTemplate

Constant Summary

Constants inherited from Formatter

Formatter::InvalidFormatterError

Instance Method Summary collapse

Methods inherited from Formatter

#close, #engine_running, #initialize, #started

Constructor Details

This class inherits a constructor from CC::Analyzer::Formatters::Formatter

Instance Method Details

#failed(_) ⇒ Object



48
49
50
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 48

def failed(_)
  exit 1
end

#finishedObject



43
44
45
46
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 43

def finished
  template = ReportTemplate.new(issues.length, issues_by_path)
  puts template.render
end

#write(data) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 29

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
  else
    raise "Invalid type found: #{json["type"]}"
  end
end