Class: MetricFu::ReekGrapher
- Inherits:
-
Grapher
- Object
- Grapher
- MetricFu::ReekGrapher
show all
- Defined in:
- lib/metric_fu/metrics/reek/grapher.rb
Instance Attribute Summary collapse
Attributes inherited from Grapher
#output_directory
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Grapher
#date, get_grapher, #graph!, graphers
Constructor Details
Returns a new instance of ReekGrapher.
10
11
12
13
14
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 10
def initialize
super
@reek_count = {}
@labels = {}
end
|
Instance Attribute Details
#labels ⇒ Object
Returns the value of attribute labels.
4
5
6
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 4
def labels
@labels
end
|
#reek_count ⇒ Object
Returns the value of attribute reek_count.
4
5
6
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 4
def reek_count
@reek_count
end
|
Class Method Details
.metric ⇒ Object
6
7
8
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 6
def self.metric
:reek
end
|
Instance Method Details
#data ⇒ Object
39
40
41
42
43
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 39
def data
@reek_count.map do |name, count|
[name, nil_counts_to_zero(count).join(",")]
end
end
|
#get_metrics(metrics, date) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 16
def get_metrics(metrics, date)
if metrics && metrics[:reek]
counter = @labels.size
@labels.update(@labels.size => date)
metrics[:reek][:matches].each do |reek_chunk|
reek_chunk[:code_smells].each do |code_smell|
@reek_count[code_smell[:type]] = [] if @reek_count[code_smell[:type]].nil?
if @reek_count[code_smell[:type]][counter].nil?
@reek_count[code_smell[:type]][counter] = 1
else
@reek_count[code_smell[:type]][counter] += 1
end
end
end
end
end
|
#output_filename ⇒ Object
45
46
47
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 45
def output_filename
"reek.js"
end
|
#title ⇒ Object
35
36
37
|
# File 'lib/metric_fu/metrics/reek/grapher.rb', line 35
def title
"Reek: code smells"
end
|