Class: RuboCop::Runner
- Inherits:
-
Object
- Object
- RuboCop::Runner
- 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
-
#aborting ⇒ Object
writeonly
Sets the attribute aborting.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #aborting? ⇒ Boolean
-
#initialize(options, config_store) ⇒ Runner
constructor
A new instance of Runner.
- #run(paths) ⇒ Object
- #trap_interrupt ⇒ Object
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(, config_store) @options = @config_store = config_store @errors = [] @warnings = [] @aborting = false end |
Instance Attribute Details
#aborting=(value) ⇒ Object (writeonly)
Sets the attribute aborting
23 24 25 |
# File 'lib/rubocop/runner.rb', line 23 def aborting=(value) @aborting = value end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
22 23 24 |
# File 'lib/rubocop/runner.rb', line 22 def errors @errors end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
22 23 24 |
# File 'lib/rubocop/runner.rb', line 22 def warnings @warnings end |
Instance Method Details
#aborting? ⇒ Boolean
52 53 54 |
# File 'lib/rubocop/runner.rb', line 52 def aborting? @aborting end |
#run(paths) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/rubocop/runner.rb', line 42 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 |
#trap_interrupt ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/rubocop/runner.rb', line 33 def trap_interrupt Signal.trap('INT') do exit!(1) if aborting? self.aborting = true warn '' warn 'Exiting... Interrupt again to exit immediately.' end end |