Doing battle with metric_fu
August 8th, 2010 by Brian | 2 Comments | Filed in work“Metric_fu is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Flay, Rcov, Reek, Roodi, Churn, RailsBestPractices, Subversion, Git, and Rails built-in stats task to create a series of reports. It’s designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder.”
It’s really a pretty sweet tool. It generates all these reports and you can either ignore them or act on them. Not saying which of those we do… but that’s not important right now.
If you’ve used metric_fu you probably ran into the NaN error. Good ol’ “Not A Number”.
Generally the output looks something like this:
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/float/rounding.rb:19:in `round_without_precision’
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/float/rounding.rb:19:in `round‘
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/base/generator.rb:135:in `round_to_tenths’
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/generators/rcov.rb:85:in `to_h’
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/base/generator.rb:131:in `generate_report‘
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/base/generator.rb:53:in `generate_report’
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/base/report.rb:54:in `add’
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/../tasks/metric_fu.rake:6
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/../tasks/metric_fu.rake:6:in `each‘
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/../tasks/metric_fu.rake:6
This particular error has cropped up several times for us, each time we do the same google searches, look at the same metric_fu sources, and slowly dissect which tests are causing this problem. Hopefully this post will help expedite debugging this error for you and your friends.


