0.0
No commit activity in last 3 years
No release in over 3 years
Code metrics from Flog, Flay, Simplecov-RCov, Saikuro, Churn, Reek, Roodi, Rails' stats task and Rails Best Practices
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
= 0.2.3
= 0.0.7
= 2.2.1
= 1.2.1
= 2.3.0
= 4.7.1
= 6.2.0
~> 0.8
= 1.2.12
= 1.0.5
= 2.1.0
= 1.1.0
 Project Readme

MetricFu Gem Version Build Status Code Climate Dependency Status

Metrics

Installation

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.

Usage

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

Compatibility

  • 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 and metric_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

Documentation

  • Cane code quality threshold checking is not included in the hotspots report

Configuration

see the .metrics file

Using Coverage Metrics

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

Rcov metrics with Ruby 1.8

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

Simplecov metrics with Ruby 1.9 and 2.0

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'

Historical

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.

Contributions

See the TODO for some ideas

See CONTRIBUTING for how to contribute

Resources:

This is the official repository for metric_fu. The original repository by Jake Scruggs at https://github.com/jscruggs/metric_fu has been deprecated..

Original Resources: