Class: RailsAppGenerator::AddOns::Rubocop

Inherits:
RailsAppGenerator::Addon show all
Defined in:
lib/rails_app_generator/addons/rubocop.rb

Overview

Add Rubocop to rails application

Instance Attribute Summary

Attributes inherited from RailsAppGenerator::Addon

#context, #dependencies, #gem_entries

Instance Method Summary collapse

Methods inherited from RailsAppGenerator::Addon

addon_name, dependencies, depends_on, gem, gem_entries, #initialize, required_gem, reset_gem_entries

Constructor Details

This class inherits a constructor from RailsAppGenerator::Addon

Instance Method Details

#applyObject



12
13
14
# File 'lib/rails_app_generator/addons/rubocop.rb', line 12

def apply
  template '.rubocop.yml.erb', '.rubocop.yml'
end

#before_templateObject



16
17
18
19
20
21
# File 'lib/rails_app_generator/addons/rubocop.rb', line 16

def before_template
  # This will cleanup the basic Rails 7 code base
  # May want to make this a setting in the future
  say 'Rubocop to cleanup the default Rails 7 code base'
  run('rubocop -A --format worst --config .rubocop.yml')
end