Class: RubyLsp::Requests::RuboCopRequest
- Inherits:
-
RuboCop::Runner
- Object
- RuboCop::Runner
- RubyLsp::Requests::RuboCopRequest
- Defined in:
- lib/ruby_lsp/requests/rubocop_request.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary collapse
- COMMON_RUBOCOP_FLAGS =
[ "--stderr", # Print any output to stderr so that our stdout does not get polluted "--format", "RuboCop::Formatter::BaseFormatter", # Suppress any output by using the base formatter ].freeze
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri, document) ⇒ RuboCopRequest
constructor
A new instance of RuboCopRequest.
- #run ⇒ Object
Constructor Details
#initialize(uri, document) ⇒ RuboCopRequest
Returns a new instance of RuboCopRequest.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ruby_lsp/requests/rubocop_request.rb', line 23 def initialize(uri, document) @file = CGI.unescape(URI.parse(uri).path) @document = document @text = document.source @uri = uri super( ::RuboCop::Options.new.parse(rubocop_flags).first, ::RuboCop::ConfigStore.new ) end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
17 18 19 |
# File 'lib/ruby_lsp/requests/rubocop_request.rb', line 17 def file @file end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
17 18 19 |
# File 'lib/ruby_lsp/requests/rubocop_request.rb', line 17 def text @text end |
Class Method Details
.run(uri, document) ⇒ Object
19 20 21 |
# File 'lib/ruby_lsp/requests/rubocop_request.rb', line 19 def self.run(uri, document) new(uri, document).run end |
Instance Method Details
#run ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/ruby_lsp/requests/rubocop_request.rb', line 35 def run # We communicate with Rubocop via stdin [:stdin] = text # Invoke the actual run method with just this file in `paths` super([file]) end |