metric_fu
Installation
gem install metric_fu
Gem
From your Gemfile ,install these gems for test and development environment
group :test ,:development do gem "metric_fu" gem 'simplecov' gem 'simplecov-rcov-text' gem 'roodi' #these gem ensure that you can run roodi or roodi . in shell end
Require
From your Rakefile
require 'churn'
Usage
From your application root. Running via Rake is still supported.
metric_fu
See:
-
metric_fu --help
for more options
Run
run "rake -T", you can see all of Commands that you can use , for example:
rake metrics:all rake metrics:cane rake metrics:churn rake metrics:flay rake metrics:flog rake metrics:hotspots rake metrics:only rake metrics:rails_best_practices rake metrics:reek rake metrics:roodi rake metrics:saikuro rake metrics:stats
Run these commands , you will get some reports at "server/tmp/metric_fu/output" and yml files at "server/tmp/metric_fu/_data"
rspec .
Run the command , you will run all testings include all of engine and get a value about test coverage
run other metric_fu features:
flog feature/ #measuring code complexity
flay feature/ #find duplicate (including copy / paste and structure)
reek . or reek features/ #spot code smells
roodi or roodi . #find a large number of general issues
rake churn #Identifies the file changes too frequently
rails_best_practices . #code matrix tool
cane #code quality threshold violation
Extra
saikuro - cyclomatic complexity measure
hotspot - hot code analysis
metric_fu :
https://github.com/metricfu/metric_fu
reek, a code smells detector for ruby :
http://silkandspinach.net/2008/09/23/reek-a-code-smells-detector-for-ruby/
How To Score Your Rails
App's Complexity Before Refactoring :
http://www.railsinside.com/tutorials/487-how-to-score-your-rails-apps-complexity-before-refactoring.html