08 Oct Supercharge your Rails app development with “Metric_fu”
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
Metric_fu will install several other dependencies unless they are already present.
These include Flay, Flog, Rcov, Reek, Facets and Roodi.
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.