Class: Rolemodel::Linters::RubocopGenerator

Inherits:
GeneratorBase
  • Object
show all
Defined in:
lib/generators/rolemodel/linters/rubocop/rubocop_generator.rb

Overview

Install the standard rubocop and a custom cop

Instance Method Summary collapse

Instance Method Details

#add_configObject



17
18
19
20
21
22
23
24
# File 'lib/generators/rolemodel/linters/rubocop/rubocop_generator.rb', line 17

def add_config
  copy_file '.rubocop.yml', force: true
  # Custom cops live in .rubocop/cops (loaded via .rubocop.yml's require:),
  # not lib/cops — keeping them out of Rails' autoload/eager-load paths so
  # they don't crash production boot referencing the dev/test-only RuboCop
  # constant.
  directory '.rubocop/cops'
end

#install_rubocopObject



9
10
11
12
13
14
15
# File 'lib/generators/rolemodel/linters/rubocop/rubocop_generator.rb', line 9

def install_rubocop
  gem_group :development, :test do
    gem 'rubocop'
    gem 'rubocop-rails'
  end
  run_bundle
end