Exception: RuboCop::Runner::InfiniteCorrectionLoop
- Inherits:
-
StandardError
- Object
- StandardError
- RuboCop::Runner::InfiniteCorrectionLoop
- Defined in:
- lib/rubocop/runner.rb
Overview
An exception indicating that the inspection loop got stuck correcting offenses back and forth.
Instance Attribute Summary collapse
-
#offenses ⇒ Object
readonly
Returns the value of attribute offenses.
Instance Method Summary collapse
-
#initialize(path, offenses_by_iteration, loop_start: -1)) ⇒ InfiniteCorrectionLoop
constructor
A new instance of InfiniteCorrectionLoop.
Constructor Details
#initialize(path, offenses_by_iteration, loop_start: -1)) ⇒ InfiniteCorrectionLoop
Returns a new instance of InfiniteCorrectionLoop.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubocop/runner.rb', line 14 def initialize(path, offenses_by_iteration, loop_start: -1) @offenses = offenses_by_iteration.flatten.uniq root_cause = offenses_by_iteration[loop_start..] .map { |x| x.map(&:cop_name).uniq.join(', ') } .join(' -> ') = 'Infinite loop detected' += " in #{path}" if path += " and caused by #{root_cause}" if root_cause += "\n" hint = 'Hint: Please update to the latest RuboCop version if not already in use, ' \ "and report a bug if the issue still occurs on this version.\n" \ 'Please check the latest version at https://rubygems.org/gems/rubocop.' super(Rainbow().red + Rainbow(hint).yellow) end |
Instance Attribute Details
#offenses ⇒ Object (readonly)
Returns the value of attribute offenses.
12 13 14 |
# File 'lib/rubocop/runner.rb', line 12 def offenses @offenses end |