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!

Advertisement

Author: Abhilash

I'm Abhilash, a web developer who specializes in Ruby development. With years of experience working with various frameworks like Rails, Angular, Sinatra, Laravel, NodeJS, React and more, I am passionate about building robust and scalable web applications. Since 2010, I have been honing my skills and expertise in the Ruby on Rails platform. This blog is dedicated to sharing my knowledge and experience on topics related to Ruby, Ruby on Rails, and other subjects that I have worked with throughout my career. Join me on this journey to explore the exciting world of web development!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: