Sha256: cbff408af380d49d4032768c8edfb7b3eb11c47dda38ea1b3b31487f9beda873
Contents?: true
Size: 918 Bytes
Versions: 1
Compression:
Stored size: 918 Bytes
Contents
# typed: strict # frozen_string_literal: true require "ruby_lsp/requests/support/rubocop_runner" return unless defined?(RubyLsp::Requests::Support::RuboCopRunner) require "cgi" require "singleton" module RubyLsp module Requests module Support # :nodoc: class RuboCopFormattingRunner extend T::Sig include Singleton sig { void } def initialize # -a is for "--auto-correct" (or "--autocorrect" on newer versions of RuboCop) @runner = T.let(RuboCopRunner.new("-a"), RuboCopRunner) end sig { params(uri: String, document: Document).returns(T.nilable(String)) } def run(uri, document) filename = CGI.unescape(URI.parse(uri).path) # Invoke RuboCop with just this file in `paths` @runner.run(filename, document.source) @runner.formatted_source end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-lsp-0.3.8 | lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb |