Sha256: beb8505a57906592c07d8cb88a887cd887f7c4c423512f6edb3fdd5769c183b7

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

require "rubycritic/analysers/reek"
require "rubycritic/smell"

module Rubycritic
  module SmellAdapter

    class Reek
      def initialize(paths)
        @reek = ::Rubycritic::Analyser::Reek.new(paths)
      end

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

      private

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

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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubycritic-0.0.12 lib/rubycritic/adapters/smell/reek.rb
rubycritic-0.0.11 lib/rubycritic/smell_adapters/reek.rb