Sha256: a46e7046cf9c6e387604554bb1e393ca97f276e1460be080cbcba1fff3a2e5b2

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

require "rubycritic/smell"

module Rubycritic
  module SmellAdapter

    class Reek
      def initialize(reek)
        @reek = reek
      end

      def smells
        @reek.smells.map do |smell|
          create_smell(smell)
        end
      end

      private

      def create_smell(smell)
        locations = smell_locations(smell.source, smell.lines)
        message   = smell.message
        context   = smell.context
        type      = smell.subclass
        Smell.new(:locations => locations, :context => context, :message => message, :type => type)
      end

      def smell_locations(file_path, file_lines)
        file_lines.uniq.sort.map do |file_line|
          Location.new(file_path, file_line)
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubycritic-0.0.6 lib/rubycritic/smell_adapters/reek.rb
rubycritic-0.0.5 lib/rubycritic/smell_adapters/reek.rb