class RubyLsp::Requests::Support::RuboCopRunner
def run(path, contents)
def run(path, contents) # Clear Runner state between runs since we get a single instance of this class # on every use site. @errors = [] @warnings = [] @offenses = [] @options[:stdin] = contents super([path]) # RuboCop rescues interrupts and then sets the `@aborting` variable to true. We don't want them to be rescued, # so here we re-raise in case RuboCop received an interrupt. raise Interrupt if aborting? rescue ::RuboCop::Runner::InfiniteCorrectionLoop => error raise Formatting::Error, error.message rescue ::RuboCop::ValidationError => error raise ConfigurationError, error.message rescue StandardError => error # Maintain the original backtrace so that debugging cops that are breaking is easier, but re-raise as a # different error class internal_error = InternalRuboCopError.new(error) internal_error.set_backtrace(error.backtrace) raise internal_error end