Sha256: 6c4eb73e4bccc7dea0b5feaeb4d2b477289dfbaed7a09abee2f6fbaf71ea8bdc
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require "rubocop" require "cgi" module RubyLsp module Requests # :nodoc: class RuboCopRequest < RuboCop::Runner 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 attr_reader :file, :text def self.run(uri, document) new(uri, document).run end 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 def run # We communicate with Rubocop via stdin @options[:stdin] = text # Invoke the actual run method with just this file in `paths` super([file]) end private def rubocop_flags COMMON_RUBOCOP_FLAGS end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-lsp-0.0.3 | lib/ruby_lsp/requests/rubocop_request.rb |