Class: MetricFu::ChurnHotspot
- Inherits:
-
Hotspot
- Object
- Hotspot
- MetricFu::ChurnHotspot
show all
- Defined in:
- lib/metric_fu/metrics/churn/hotspot.rb
Constant Summary
collapse
- COLUMNS =
%w{times_changed}
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
#calculate_score(metric_ranking, item) ⇒ Object
24
25
26
27
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 24
def calculate_score(metric_ranking, item)
flat_churn_score = 0.50
metric_ranking.scored?(item) ? flat_churn_score : 0
end
|
#columns ⇒ Object
4
5
6
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 4
def columns
COLUMNS
end
|
#generate_records(data, table) ⇒ Object
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 29
def generate_records(data, table)
return if data == nil
Array(data[:changes]).each do |change|
table << {
"metric" => :churn,
"times_changed" => change[:times_changed],
"file_path" => change[:file_path]
}
end
end
|
#map_strategy ⇒ Object
12
13
14
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 12
def map_strategy
:present
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 8
def name
:churn
end
|
#present_group(group) ⇒ Object
40
41
42
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 40
def present_group(group)
"detected high level of churn (changed #{group[0].times_changed} times)"
end
|
#reduce_strategy ⇒ Object
16
17
18
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 16
def reduce_strategy
:sum
end
|
#score_strategy ⇒ Object
20
21
22
|
# File 'lib/metric_fu/metrics/churn/hotspot.rb', line 20
def score_strategy
:calculate_score
end
|