Class: Rubysmith::Extensions::Rubocop

Inherits:
Object
  • Object
show all
Defined in:
lib/rubysmith/extensions/rubocop.rb

Overview

Ensures project skeleton adheres to style guide.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, client: ::RuboCop::CLI.new) ⇒ Rubocop

Returns a new instance of Rubocop.



16
17
18
19
# File 'lib/rubysmith/extensions/rubocop.rb', line 16

def initialize configuration, client: ::RuboCop::CLI.new
  @configuration = configuration
  @client = client
end

Class Method Details

.callObject



14
# File 'lib/rubysmith/extensions/rubocop.rb', line 14

def self.call(...) = new(...).call

Instance Method Details

#callObject



21
22
23
24
25
26
27
28
29
# File 'lib/rubysmith/extensions/rubocop.rb', line 21

def call
  project_root = configuration.project_root

  project_root.change_dir do
    STDOUT.squelch { client.run ["--autocorrect-all", project_root.to_s] }
  end

  configuration
end