123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::Lsp::StdinRunner Private

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

::RuboCop::Runner - Inherited

#aborting=, #aborting?, #errors, #warnings, #cached_run?, #except_redundant_cop_disable_directive?,
#in_memory_corrections_possible?

Custom ruby extractors may derive their fragments from the file on disk rather than from the passed processed source, so corrections can only be kept in memory when the default extractor is used.

#project_index_disables_parallel?, #project_index_enabled?

Instance Method Summary

::RuboCop::Runner - Inherited

Constructor Details

.new(config_store) ⇒ StdinRunner

[ GitHub ]

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

def initialize(config_store)
  @options = {}

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

  @config_for_working_directory = config_store.for_pwd

  super(@options, config_store)
end

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, :processed_source

#offenses (readonly)

[ GitHub ]

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

attr_reader :offenses, :config_for_working_directory, :processed_source

#processed_source (readonly)

[ GitHub ]

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

attr_reader :offenses, :config_for_working_directory, :processed_source

Instance Method Details

#do_inspection_loop(file) (private)

[ GitHub ]

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

def do_inspection_loop(file)
  source, offenses = super
  @processed_source = source
  [source, offenses]
end

#file_finished(_file, offenses) (private)

[ GitHub ]

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

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

#formatted_source

[ GitHub ]

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

def formatted_source
  @options[:stdin]
end

#run(path, contents, options, prism_result: nil)

Raises:

  • (Interrupt)
[ GitHub ]

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

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

  @prism_result = prism_result
  @processed_source = nil

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

  super([path])

  raise Interrupt if aborting?
end