You can find me on twitter via @carl_furrow

Getting metric_fu to play with rspec

by Carl on May 14, 2010

I grabbed metric_fu, installed all the required gems, then ran “rake metrics:all” and it would die because it couldn’t find my tests. Turns out you have to take an extra, minor, step to get it to stop ignoring your rspec files.

I found this post, and it gave me this to put in my lib/tasks/metric_fu.task file:

begin
  require 'metric_fu'
  MetricFu::Configuration.run do |config|
        #define which metrics you want to use
        config.metrics  = [:churn, :saikuro, :stats, :flog, :flay, :reek, :roodi, :rcov]
        config.flay     = { :dirs_to_flay => ['app/models', 'spec/models', 'lib']  }
        config.flog     = { :dirs_to_flog => ['app/models', 'spec/models', 'lib']  }
        config.reek     = { :dirs_to_reek => ['app/models', 'spec/models', 'lib']  }
        config.roodi    = { :dirs_to_roodi => ['app/models','spec/models', 'lib']  }
        config.saikuro  = { :output_directory => 'scratch_directory/saikuro',
                            :input_directory => ['app/models', 'spec/models', 'lib'],
                            :cyclo => "",
                            :filter_cyclo => "0",
                            :warn_cyclo => "5",
                            :error_cyclo => "7",
                            :formater => "text"}
        config.churn    = { :start_date => "1 year ago", :minimum_churn_count => 10}
        config.rcov[:rcov_opts] << "-Itest"
  end
rescue LoadError
end

Leave a Comment

Powered by WP Hashcash

Previous post:

Next post: