Sha256: 1ee8eeb7a867bf705ecb32407a466c34e445d0d8773fef349ab2cfe6082e4831
Contents?: true
Size: 871 Bytes
Versions: 12
Compression:
Stored size: 871 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 RuboCopDiagnosticsRunner extend T::Sig include Singleton sig { void } def initialize @runner = T.let(RuboCopRunner.new, RuboCopRunner) end sig { params(uri: String, document: Document).returns(T::Array[Support::RuboCopDiagnostic]) } 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.offenses.map do |offense| Support::RuboCopDiagnostic.new(offense, uri) end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems