Some help with metric-fu

I’m apologize for my English, before.

I’m doing a post graduation thesis about BDD, an my initial idea is to
compare a ruby program built by TDD and after by BDD. In these cases,
the both projects have identical code, excepts the tests that were made
by Test::Unit and Rspec respectively. So I’m using some code metrics
like rcov, flay, flog and etc. for compare the generated tests.

I made the same for a rails project. I built a blog with three models
(user, post and comment) using TDD approach using Test::Unit. After I
did the same project using the BDD approach for build the same code but
using rspec instead Test::Unit framework. In both projects the total
number of tests are the same and the code generated are identical. So I
tried to use metric-fu for compare these rails projects and the results
left me frustrated.

The flog and roodi’s metrics showing noting!
I need to measure files user.rb, post.rb, comment.rb
in app/models and user_test.rb, post_test.rb, comment_test.rb in
test/unit.

My metric-fu.rake is:

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.graphs = []
config.flay = { :dirs_to_flay => [‘app/models’, ‘test/unit’,
‘lib’] }
config.flog = { :dirs_to_flog => [‘app/models’, ‘test/unit’,
‘lib’] }
config.reek = { :dirs_to_reek => [‘app/models’, ‘test/unit’,
‘lib’] }
config.roodi = { :dirs_to_roodi => [‘app/models’,‘test/unit’,
‘lib’] }
config.saikuro = { :output_directory =>
‘scratch_directory/saikuro’,
:input_directory => [‘app/models’,
‘test/unit’, ‘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

and for rails rspec project

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.graphs = []
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” # doens’t work too.
end
rescue LoadError
end

I need to improve this rake file for show more information (and to
include flog and roodi measures).

For me rcov doesn’t work with this default configuration:

config.rcov = { :test_files => [‘test//*_test.rb’,
'spec/
/*_spec.rb’],
:rcov_opts => ["–sort coverage",
“–no-html”,
“–text-coverage”,
“–no-color”,
“–profile”,
“–rails”,
“–exclude
/gems/,/Library/,spec”]}
Why?

And when I execute rake metrics :all these errors happen:

(in /home/bruno/workRails/blog_spec)

  • master

/usr/local/lib/ruby/gems/1.8/gems/flog-2.1.2/bin/flog:11: undefined
method `flog_files’ for #Flog:0xb7903708 (NoMethodError)

from /usr/local/bin/flog:19:in `load’

from /usr/local/bin/flog:19

No file to analyze was found. All the files loaded by rcov matched one
of the

following expressions, and were thus ignored:

[/\A/usr/local/lib/,

/\btc_[^.]*.rb/,

/_test.rb\z/,
… and blablabla

Can anyone help me with these questions?

Thank’s so much, Bruno.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs