app/services/statistics.rb
Complex method Statistics::variance (20.1) Open
Open
def self.variance(enumerable, sample_size = enumerable.size)
slice = slice_to_sample_size(enumerable, sample_size)
total = slice.size > 1 && (total(slice) < total(enumerable)) ? total(slice) - 1 : sample_size
mean = mean(slice)
sum(slice.map { |sample| (mean - sample)**2 }) / total
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool