tasks/metrics/flay.rake in veritas-do-adapter-0.0.6 vs tasks/metrics/flay.rake in veritas-do-adapter-0.0.7
- old
+ new
@@ -13,10 +13,10 @@
task :flay do
# run flay once without a threshold to ensure the max mass matches the threshold
flay = Flay.new(:fuzzy => false, :verbose => false, :mass => 0)
flay.process(*files)
- max = flay.masses.map { |hash, mass| mass.to_f / flay.hashes[hash].size }.max
+ max = (flay.masses.map { |hash, mass| mass.to_f / flay.hashes[hash].size }.max) || 0
unless max >= threshold
raise "Adjust flay threshold down to #{max}"
end
total = flay.masses.reduce(0.0) { |total, (hash, mass)| total + (mass.to_f / flay.hashes[hash].size) }