123456789_123456789_123456789_123456789_123456789_

Exception: RuboCop::Runner::InfiniteCorrectionLoop

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, StandardError
Instance Chain:
self, StandardError
Inherits: StandardError
  • Object
Defined in: lib/rubocop/runner.rb

Overview

An exception indicating that the inspection loop got stuck correcting offenses back and forth.

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(path, offenses_by_iteration, loop_start: -1)) ⇒ InfiniteCorrectionLoop

[ GitHub ]

  
# 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(' -> ')

  message = 'Infinite loop detected'
  message += " in #{path}" if path
  message += " and caused by #{root_cause}" if root_cause
  message += "\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(message).red + Rainbow(hint).yellow)
end

Instance Attribute Details

#offenses (readonly)

[ GitHub ]

  
# File 'lib/rubocop/runner.rb', line 12

attr_reader :offenses