Sha256: a2123a0caf08ec57aefaf7215c027fc3dfa86d316579aef55608ba14b6ed6a07

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

module Slimembedcop
  # Collect RuboCop offenses from Template code.
  class OffenseCollector
    def initialize(path, config, source, autocorrect, debug)
      @path = path
      @config = config
      @source = source
      @autocorrect = autocorrect
      @debug = debug
    end

    def run
      snippets.flat_map do |snippet|
        RubyOffenseCollector.new(@path, @config, snippet[:code], @autocorrect, @debug).run.map do |offense|
          Offense.new(@path, snippet[:offset], offense, @source)
        end
      end
    end

    private

    def snippets
      Extractor.new(@source).run
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slimembedcop-1.0.0 lib/slimembedcop/offense_collector.rb
slimembedcop-0.2.0 lib/slimembedcop/offense_collector.rb