Class: RuboCop::Runner

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

Overview

This class handles the processing of files, which includes dealing with formatters and letting cops inspect the files.

Defined Under Namespace

Classes: InfiniteCorrectionLoop

Constant Summary collapse

MAX_ITERATIONS =
200

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, config_store) ⇒ Runner

Returns a new instance of Runner.



25
26
27
28
29
30
31
# File 'lib/rubocop/runner.rb', line 25

def initialize(options, config_store)
  @options = options
  @config_store = config_store
  @errors = []
  @warnings = []
  @aborting = false
end

Instance Attribute Details

#abortingObject (readonly) Also known as: aborting?

Returns the value of attribute aborting.



22
23
24
# File 'lib/rubocop/runner.rb', line 22

def aborting
  @aborting
end

#errorsObject (readonly)

Returns the value of attribute errors.



22
23
24
# File 'lib/rubocop/runner.rb', line 22

def errors
  @errors
end

#warningsObject (readonly)

Returns the value of attribute warnings.



22
23
24
# File 'lib/rubocop/runner.rb', line 22

def warnings
  @warnings
end

Instance Method Details

#abortObject



43
44
45
# File 'lib/rubocop/runner.rb', line 43

def abort
  @aborting = true
end

#run(paths) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/rubocop/runner.rb', line 33

def run(paths)
  target_files = find_target_files(paths)
  if @options[:list_target_files]
    list_files(target_files)
  else
    warm_cache(target_files) if @options[:parallel]
    inspect_files(target_files)
  end
end