Class: Templatecop::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/templatecop/runner.rb

Overview

Run investigation and auto-correcttion.

Instance Method Summary collapse

Constructor Details

#initialize(auto_correct:, file_paths:, formatter:, rubocop_config:, ruby_extractor:) ⇒ Runner

Returns a new instance of Runner.

Parameters:

  • auto_correct (Boolean)
  • file_paths (Array<String>)
  • formatter (Object)
  • rubocop_config (RuboCop::Config)
  • ruby_extractor (#call)


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/templatecop/runner.rb', line 14

def initialize(
  auto_correct:,
  file_paths:,
  formatter:,
  rubocop_config:,
  ruby_extractor:
)
  @auto_correct = auto_correct
  @file_paths = file_paths
  @formatter = formatter
  @rubocop_config = rubocop_config
  @ruby_extractor = ruby_extractor
end

Instance Method Details

#callArray<RuboCop::Cop::Offense>

Returns:

  • (Array<RuboCop::Cop::Offense>)


29
30
31
32
33
34
35
36
# File 'lib/templatecop/runner.rb', line 29

def call
  on_started
  result = run_in_parallel
  on_finished(result)
  result.flat_map do |(_, offenses)|
    offenses
  end
end