123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::Lsp::StdinRunner Private

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Exceptions:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: RuboCop::Runner
Defined in: lib/rubocop/lsp/stdin_runner.rb

Overview

Constant Summary

::RuboCop::Runner - Inherited

MAX_ITERATIONS, REDUNDANT_COP_DISABLE_DIRECTIVE_RULES

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#config_for_working_directory (readonly)

[ GitHub ]

  
# File 'lib/rubocop/lsp/stdin_runner.rb', line 20

attr_reader :offenses, :config_for_working_directory

#offenses (readonly)

[ GitHub ]

  
# File 'lib/rubocop/lsp/stdin_runner.rb', line 20

attr_reader :offenses, :config_for_working_directory

Instance Method Details

#file_finished(_file, offenses) (private)

[ GitHub ]

  
# File 'lib/rubocop/lsp/stdin_runner.rb', line 78

def file_finished(_file, offenses)
  @offenses = offenses
end

#formatted_source

[ GitHub ]

  
# File 'lib/rubocop/lsp/stdin_runner.rb', line 72

def formatted_source
  @options[:stdin]
end

#run(path, contents, options)

[ GitHub ]

  
# File 'lib/rubocop/lsp/stdin_runner.rb', line 44

def run(path, contents, options)
  @options = options.merge(DEFAULT_RUBOCOP_OPTIONS)
  @options[:stdin] = contents

  @offenses = []
  @warnings = []
  @errors = []

  super([path])

  raise Interrupt if aborting?
rescue RuboCop::Runner::InfiniteCorrectionLoop => e
  if defined?(::RubyLsp::Requests::Formatting::Error)
    raise ::RubyLsp::Requests::Formatting::Error, e.message
  end

  raise e
rescue RuboCop::ValidationError => e
  raise ConfigurationError, e.message
rescue StandardError => e
  if defined?(::RubyLsp::Requests::Formatting::Error)
    raise ::RubyLsp::Requests::Support::InternalRuboCopError, e
  end

  raise e
end