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!

Advertisements

Author: Abhi

Hi, this is Abhilash - Senior Programmer Analyst at CoMakeIT, specialised on web programming. Mainly working on Ruby On Rails platform since 2010.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s