Class: MetricFu::FlogHotspot
- Inherits:
-
Hotspot
- Object
- Hotspot
- MetricFu::FlogHotspot
show all
- Defined in:
- lib/metric_fu/metrics/flog/hotspot.rb
Constant Summary
collapse
- COLUMNS =
%w{score}
Instance Method Summary
collapse
Methods inherited from Hotspot
analyzer_for_metric, analyzers, #get_mean, #map, #mapping_strategies, metric, #not_implemented, #reduce, #score
Instance Method Details
#columns ⇒ Object
4
5
6
|
# File 'lib/metric_fu/metrics/flog/hotspot.rb', line 4
def columns
COLUMNS
end
|
#generate_records(data, table) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/metric_fu/metrics/flog/hotspot.rb', line 24
def generate_records(data, table)
return if data == nil
Array(data[:method_containers]).each do |method_container|
Array(method_container[:methods]).each do |entry|
file_path = entry[1][:path].sub(%r{^/}, "") if entry[1][:path]
location = MetricFu::Location.for(entry.first)
table << {
"metric" => name,
"score" => entry[1][:score],
"file_path" => file_path,
"class_name" => location.class_name,
"method_name" => location.method_name
}
end
end
end
|
#map_strategy ⇒ Object
12
13
14
|
# File 'lib/metric_fu/metrics/flog/hotspot.rb', line 12
def map_strategy
:score
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/metric_fu/metrics/flog/hotspot.rb', line 8
def name
:flog
end
|
#present_group(group) ⇒ Object
41
42
43
44
45
|
# File 'lib/metric_fu/metrics/flog/hotspot.rb', line 41
def present_group(group)
occurences = group.size
complexity = get_mean(group.column("score"))
"#{'average ' if occurences > 1}complexity is %.1f" % complexity
end
|
#reduce_strategy ⇒ Object
16
17
18
|
# File 'lib/metric_fu/metrics/flog/hotspot.rb', line 16
def reduce_strategy
:average
end
|
#score_strategy ⇒ Object
20
21
22
|
# File 'lib/metric_fu/metrics/flog/hotspot.rb', line 20
def score_strategy
:identity
end
|