The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Metric_fu Now Measures Churn

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jake Scruggs

Posts: 336
Nickname: aurorae314
Registered: Feb, 2008

Jake Scruggs is a developer at ThoughtWorks
Metric_fu Now Measures Churn Posted: May 11, 2008 9:45 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jake Scruggs.
Original Post: Metric_fu Now Measures Churn
Feed Title: Jake Scruggs
Feed URL: http://jakescruggs.blogspot.com/feeds/posts/default
Feed Description: Ruby, Rails, Metrics, Testing, and pursuit of clean code.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jake Scruggs
Latest Posts From Jake Scruggs

Advertisement
Sometimes a class does too much. It's used everywhere, does everything, knows all about the nasty internals of all the other classes, and every time you change anything in the application it has to change. Or maybe you have a class that everyone loves to refactor because it's so bad. One developer changes it to be better, then another changes it to be a different kind of better, and this keeps happening without it ever getting any easier to use. There's a lot of bad reasons why a class might change all the time so I added a churn report capability to metric_fu version 0.6.0.

Now you can use metric_fu to create a report like this:

By issuing this command:
    rake metrics:churn
And use the results to find classes that might have problems. It uses 'svn log' to create this report so currently you need to be using subversion. (If anyone out there want to contribute some code to get it working with git, lemme know.) The default is to start counting changes from the start of the repository's creation. That may be too much for your project so you can change the start by adding these lines to your Rakefile:
    namespace :metrics do
CHURN_OPTIONS = { :start_date => lambda{3.months.ago} }
end
The Proc is there because '3.months.ago' only works after the Rails Environment is loaded (and Rails extends Fixnum) which I didn't want to do every time you run a rake task.

You can also change the minimum churn count (files with changes less than this number won't be included in the report) like so:
    namespace :metrics do
CHURN_OPTIONS = { :minimum_churn_count => 3 }
end
Also in this release I added the 'metrics:all_with_migrate' task because of some feedback I got that running 'metrics:all' in a cc.rb build fails if there have been migrations. So the new task migrates the test db before running all the metrics tasks.

Check out the metric_fu project home page for more information and installation instructions. Or you can jump right in by doing this in the root of your project:
script/plugin install \
http://metric-fu.rubyforge.org/svn/tags/CURRENT/metric_fu/
sudo gem install rcov
sudo gem install flog

Read: Metric_fu Now Measures Churn

Topic: Hey GitHub, nice Rack... Previous Topic   Next Topic Topic: bool_attr_accessor for convenient question marks

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use