Sha256: 6b84e8a896a21841d0fcb0ac1d3ef5a73b23dd8c29fc57a496a925b292e39d8b
Contents?: true
Size: 718 Bytes
Versions: 2
Compression:
Stored size: 718 Bytes
Contents
# frozen_string_literal: true require 'parser' require 'rubocop/cop/legacy/corrector' module Slimembedcop # Apply auto-corrections to Template file. class TemplateCorrector def initialize(path, offenses, source) @path = path @offenses = offenses @source = source end def run ::RuboCop::Cop::Legacy::Corrector.new(source_buffer, corrections).rewrite end private def source_buffer ::Parser::Source::Buffer.new(@path, source: @source) end def corrections @offenses.select(&:corrector).map do |offense| lambda do |corrector| corrector.import!(offense.corrector, offset: offense.offset) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slimembedcop-1.0.0 | lib/slimembedcop/template_corrector.rb |
slimembedcop-0.2.0 | lib/slimembedcop/template_corrector.rb |