gem install metric_fu
If you have trouble installing the gem, try adding metric_fu to your Gemfile. You may also want to file a ticket on the issues page.
See documentation on the rubyforge page for how to customize your metrics. Otherwise, all current information is either in this repo or on the wiki.
By default, you can run all metrics from the root of an app with the command metric_fu -r
See metric_fu --help
for more options
-
It is currently testing on MRI 1.9.2, 1.9.3 and 2.0.0. Ruby 1.8 is no longer supported due to the cane library.
-
For 1.8.7 support, see version 3.0.0 for partial support, or 2.1.3.7.18.1 (where Semantic Versioning goes to die)
-
The
japgolly-Saikuro
fork andmetric_fu-roodi
fork are a part of an attempt to get metric_fu working in a modern Ruby environment, specifically compatibility with Ruby 1.9 and Bundler. -
metric_fu no longer runs rcov itself. You may still use rcov metrics as documented below
-
The Cane, Flog, and Rails Best Practices metrics are disabled in non-MRI rubies as they depend on ripper
- Cane code quality threshold checking is not included in the hotspots report
see the .metrics file
in your .metrics file add the below to run pre-generated metrics
MetricFu::Configuration.run do |config|
coverage_file = File.expand_path("coverage/rcov/rcov.txt", Dir.pwd)
config.add_metric(:rcov)
config.add_graph(:rcov)
config.configure_metric(:rcov, {:external => coverage_file})
end
if you want metric_fu to actually run rcov itself (1.8 only), just add
MetricFu.run_rcov
To generate the same metrics metric_fu has been generating run from the root of your project before running metric_fu
RAILS_ENV=test rcov $(ruby -e "puts Dir['{spec,test}/**/*_{spec,test}.rb'].join(' ')") --sort coverage --no-html --text-coverage --no-color --profile --exclude-only '.*' --include-file "\Aapp,\Alib" -Ispec >> coverage/rcov/rcov.txt
Add to your Gemfile or otherwise install
gem 'simplecov'
# https://github.com/kina/simplecov-rcov-text
gem 'simplecov-rcov-text'
Modify your spec_helper as per the SimpleCov docs and run your tests before running metric_fu
#in your spec_helper
require 'simplecov'
require 'simplecov-rcov-text'
SimpleCov.formatter = SimpleCov::Formatter::RcovTextFormatter
SimpleCov.start
# SimpleCov.start 'rails'
There is some useful-but-out-of-date documentation about configuring metric_fu at http://metric-fu.rubyforge.org/ and a change log in the the HISTORY file.
See the TODO for some ideas
See CONTRIBUTING for how to contribute
This is the official repository for metric_fu. The original repository by Jake Scruggs at https://github.com/jscruggs/metric_fu has been deprecated..
- Github: http://github.com/metricfu/metric_fu
- Issue Tracker: http://github.com/metricfu/metric_fu/issues
- Google Group: http://groups.google.com/group/metric_fu
- Historical Homepage: http://metric-fu.rubyforge.org/
- Github: http://github.com/jscruggs/metric_fu
- Issue Tracker: http://github.com/jscruggs/metric_fu/issues
- Jake's Blog: http://jakescruggs.blogspot.com/