Class: CC::Analyzer::Formatters::Formatter
- Inherits:
-
Object
- Object
- CC::Analyzer::Formatters::Formatter
show all
- Defined in:
- lib/cc/analyzer/formatters/formatter.rb
Constant Summary
collapse
- InvalidFormatterError =
Class.new(StandardError)
Instance Method Summary
collapse
Constructor Details
#initialize(filesystem, output = $stdout) ⇒ Formatter
Returns a new instance of Formatter.
5
6
7
8
|
# File 'lib/cc/analyzer/formatters/formatter.rb', line 5
def initialize(filesystem, output = $stdout)
@filesystem = filesystem
@output = output
end
|
Instance Method Details
#close ⇒ Object
39
40
|
# File 'lib/cc/analyzer/formatters/formatter.rb', line 39
def close
end
|
#engine_running(engine) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/cc/analyzer/formatters/formatter.rb', line 29
def engine_running(engine)
@current_engine = engine
yield
ensure
@current_engine = nil
end
|
#failed(_output) ⇒ Object
42
43
|
# File 'lib/cc/analyzer/formatters/formatter.rb', line 42
def failed(_output)
end
|
#finished ⇒ Object
36
37
|
# File 'lib/cc/analyzer/formatters/formatter.rb', line 36
def finished
end
|
#started ⇒ Object
26
27
|
# File 'lib/cc/analyzer/formatters/formatter.rb', line 26
def started
end
|
#write(data) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# 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
|