Use Ruby Metrical Gem for reviewing your rails code and find the rails best practises with rails_best_practices gem

Install the metrical gem first to run metrical.

$ gem install metrical

If the output showing an error like: Gem::DependencyError, then install the gem metric_fu first, which installs all the dependencies required.

$ gem install metric_fu

Then try to install the metrical gem

I got the following error:

vnet6@ubuntu:~/projects/grouptable$ gem install metrical
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: metric_fu requires sexp_processor (~> 3.0.3); churn requires sexp_processor (~> 3.0); reek requires sexp_processor (~> 3.0); ruby2ruby requires sexp_processor (~> 3.0); ripper_ruby_parser requires sexp_processor (~> 3.0); flog requires sexp_processor (~> 3.0); ruby_parser requires sexp_processor (~> 3.0)

In my system sexp_processor version was (4.2.1)

I uninstalled the version,

$ gem uninstall sexp_processor

and installed the version 3.0.3

$ gem list sexp_processor -v '3.0.3'

and installed the metrical gem by

$ gem install metrical

run metrical gem by

$ metrical

But this is also giving me error! It has a lot of dependencies. It is asking again the sexp_processor version (4.2.1). So Installed two versions so the error gone and got another error!

So I tried the rails_best_practices to see the warnings.

$ gem install rails_best_practices
$ rails_best_practices
$ rails_best_practices -f html # to see the warnings in html

Its working fine!

Unknown's avatar

Author: Abhilash

Hi, Iโ€™m Abhilash! A seasoned web developer with 15 years of experience specializing in Ruby and Ruby on Rails. Since 2010, Iโ€™ve built scalable, robust web applications and worked with frameworks like Angular, Sinatra, Laravel, Node.js, Vue and React. Passionate about clean, maintainable code and continuous learning, I share insights, tutorials, and experiences here. Letโ€™s explore the ever-evolving world of web development together!

Leave a comment