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 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

200
REDUNDANT_COP_DISABLE_DIRECTIVE_RULES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[
  Lint/RedundantCopDisableDirective RedundantCopDisableDirective Lint
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, config_store) ⇒ Runner

Returns a new instance of Runner.



38
39
40
41
42
43
44
# File 'lib/rubocop/runner.rb', line 38

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

Instance Attribute Details

#aborting=(value) ⇒ Object (writeonly)

Sets the attribute aborting

Parameters:

  • value

    the value to set the attribute aborting to.



36
37
38
# File 'lib/rubocop/runner.rb', line 36

def aborting=(value)
  @aborting = value
end

#errorsObject (readonly)

Returns the value of attribute errors.



35
36
37
# File 'lib/rubocop/runner.rb', line 35

def errors
  @errors
end

#warningsObject (readonly)

Returns the value of attribute warnings.



35
36
37
# File 'lib/rubocop/runner.rb', line 35

def warnings
  @warnings
end

Instance Method Details

#aborting?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/rubocop/runner.rb', line 62

def aborting?
  @aborting
end

#run(paths) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rubocop/runner.rb', line 46

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
rescue Interrupt
  self.aborting = true
  warn ''
  warn 'Exiting...'

  false
end