Sha256: 542a1e12a6f50d66013ca1549d4ab4b03f9a3836b6d35129c0135379b33c3e8e
Contents?: true
Size: 983 Bytes
Versions: 14
Compression:
Stored size: 983 Bytes
Contents
require_relative "stdin_rubocop_runner" require_relative "diagnostic" module Standard module Lsp class Standardizer def initialize(config) @diagnostic_runner = ::Standard::Lsp::StdinRubocopRunner.new(config) @format_runner = ::Standard::Lsp::StdinRubocopRunner.new(config.dup.tap { |c| c.rubocop_options[:autocorrect] = true }) @cop_registry = RuboCop::Cop::Registry.global.to_h end def format(path, text) @format_runner.run(path, text) @format_runner.formatted_source end def offenses(path, text, document_encoding = nil) @diagnostic_runner.run(path, text) @diagnostic_runner.offenses.map do |offense| Diagnostic.new( document_encoding, offense, path, @cop_registry[offense.cop_name]&.first ).to_lsp_diagnostic(@diagnostic_runner.config_for_working_directory) end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems