sajad torkamani

Install gem

Add to Gemfile:

group :development do
  gem 'rubocop', require: false
  gem 'rubocop-rails', require: false
  gem 'rubocop-rspec', require: false
end

Install gems:

./bin/bundle install

Generate binstubs:

./bin/bundle binstubs rubocop

Create .rubocop.yml file

Run:

./bin/rubocop --init

Set contents of file to:

require:
  - rubocop-rails
  - rubocop-rspec

AllCops:
  NewCops: enable

Layout/ArgumentAlignment:
  Enabled: false

Layout/LineLength:
  Exclude:
    - config/initializers/**/*.rb

Layout/FirstHashElementIndentation:
  EnforcedStyle: consistent

Metrics/BlockLength:
  Exclude:
    - spec/**/*
    - config/**/*.rb

Metrics/AbcSize:
  Exclude:
    - db/migrate/**/*

Metrics/MethodLength:
  Exclude:
    - db/migrate/**/*

Rails/DynamicFindBy:
  Enabled: false

Rails/FilePath:
  Enabled: false

Rails/Output:
  Exclude:
    - lib/tasks/**/*

RSpec/ExampleLength:
  Enabled: false

RSpec/MultipleExpectations:
  Enabled: false

RSpec/MultipleMemoizedHelpers:
  Enabled: false

RSpec/RepeatedDescription:
  Exclude:
    - spec/policies/**/

RSpec/RepeatedExample:
  Exclude:
    - spec/policies/**/

Style/BlockDelimiters:
  Exclude:
    - spec/**/*

Style/ClassAndModuleChildren:
  Enabled: false

Style/Documentation:
  Enabled: false

Style/IfUnlessModifier:
  Enabled: false

Fix safe errors

./bin/rubocop -a

Fix unsafe errors

./bin/rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFetchBlock,Style/GlobalStdStream