Class: RuboCop::Lsp::StdinRunner Private
| Relationships & Source Files | |
| Namespace Children | |
|
Exceptions:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::RuboCop::Runner
|
|
|
Instance Chain:
self,
::RuboCop::Runner
|
|
| Inherits: |
RuboCop::Runner
|
| Defined in: | lib/rubocop/lsp/stdin_runner.rb |
Overview
Constant Summary
-
DEFAULT_RUBOCOP_OPTIONS =
# File 'lib/rubocop/lsp/stdin_runner.rb', line 22{ stderr: true, force_exclusion: true, formatters: ['RuboCop::Formatter::BaseFormatter'], raise_cop_error: true, todo_file: nil, todo_ignore_files: [] }.freeze
::RuboCop::Runner - Inherited
Class Method Summary
- .new(config_store) ⇒ StdinRunner constructor Internal use only
::RuboCop::Runner - Inherited
Instance Attribute Summary
- #config_for_working_directory readonly Internal use only
- #offenses readonly Internal use only
- #processed_source readonly Internal use only
::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
- #formatted_source Internal use only
-
#reset_project_index
Internal use only
Drop the cached project index so the next run rebuilds it.
- #run(path, contents, options, prism_result: nil) Internal use only
-
#build_project_index(target_files)
private
Internal use only
The project index is built from files on disk, not from the in-memory buffer, so it does not change while the user is typing.
- #do_inspection_loop(file) private Internal use only
- #file_finished(_file, offenses) private Internal use only
::RuboCop::Runner - Inherited
Constructor Details
.new(config_store) ⇒ StdinRunner
# 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
#build_project_index(target_files) (private)
The project index is built from files on disk, not from the in-memory buffer, so it does not change while the user is typing. Build it once and reuse it across runs instead of re-walking and re-indexing the whole project on every request; #reset_project_index drops the cache when the on-disk state changes.
# File 'lib/rubocop/lsp/stdin_runner.rb', line 78
def build_project_index(target_files) return if @project_index_built super @project_index_built = true end
#do_inspection_loop(file) (private)
[ GitHub ]#file_finished(_file, offenses) (private)
[ GitHub ]#formatted_source
[ GitHub ]# File 'lib/rubocop/lsp/stdin_runner.rb', line 59
def formatted_source @options[:stdin] end
#reset_project_index
Drop the cached project index so the next run rebuilds it. Called when a file is saved or a watched file changes, i.e. when the on-disk state the index is derived from may have changed.
# File 'lib/rubocop/lsp/stdin_runner.rb', line 66
def reset_project_index @project_index = nil @project_index_built = false end
#run(path, contents, options, prism_result: nil)
# File 'lib/rubocop/lsp/stdin_runner.rb', line 43
def run(path, contents, , prism_result: nil) @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