Sha256: c51cd27fcf5ae6f99807c4798723d81142e354b6a4311fc1a2acf4887b8db484
Contents?: true
Size: 906 Bytes
Versions: 10
Compression:
Stored size: 906 Bytes
Contents
# typed: strict # frozen_string_literal: true 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 include Support::FormatterRunner 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 { override.params(uri: String, document: Document).returns(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
10 entries across 10 versions & 1 rubygems