Supercharge your Rails app development with “Metric_fu”

Supercharge your Rails app development with “Metric_fu”

2 Minutes Read

Why we need Metric_fu?

Sometimes we are unaware of unknown complexities in our rails code and it gets messy. Moreover, it reduces application performance, scalability and maintainability.

What is Metric_fu?

Metric_fu is a set of rake tasks and compilation of several different tools that provides reports. This show which parts of your rails code might need extra work. It uses the following built-in tasks to create a series of reports.

  • Rcov – Measures test coverage
  • Flog – Measures code complexity
  • Saikuro – Measures cyclomatic complexity
  • Flay – Finds duplication (both copy/paste and structural)
  • Reek – Spots code smells
  • Roodi – Finds lots of general problems
  • Churn – Identifies files that changes too often
  • Rails best practices – code matric tool
  • Cane -code quality threshold violations
  • HotSpot– Meta analysis of your metrics to find hotspots in the code

Benefits of Metric_fu

  • You can measure the complexity of rails code
  • Creates a “hit list” of most complex methods
  • Reveals hidden issues like bugs and other complexities
  • Examine worst offenders
  • Refactoring complex methods
  • Creates smaller, easier to understand methods


  • Add ‘metric_fu’ gem to your gem file
gem "metric_fu"
  • Run “bundle install”
  • Metric_fu will install several other dependencies unless they are already present.
    These include Flay, Flog, Rcov, Reek, Facets and Roodi.

  • Run following command to generate the metrics
  • rake metrics:all

    It will generate a metric of your code in the temp/matric_fu repository,
    it uses a number of other open source project to generate the metric.


    Code analysis isn’t an exact science and none of the tools shown are perfect in themselves.
    So they should all be used as an aid to help you find complex areas of your code and
    supercharge Rails app development.

    , ,
    Srikant M. Mohapatra
    No Comments

    Post A Comment

    Exit pop up

    Sad to see you leaving early...

    From "Aha" to "Oh shit" we are sharing everything on our journey.
    Enter your email address to stay up to date with the latest news.
    Holler Box