Improve ruby code using Code Analyzer

Rubocop is a code analyzer gem which allows you to write code that follows the style guide dictated by the Ruby community, The gem also has lots of configuration options

Let's install Rubocop

gem install rubocop
cd your_rails_app
 
rubocop
This will scan all of your Ruby files in your application.

rubocop app
This will scan only the app directory.

rubocop -o code.rb
-o writes output to a file instead of STDOUT

Comments

Popular posts from this blog

Inserting and Moving elements inside Ruby Array

Difference between Validations, Callbacks and Observers