Sha256: 3deeae7bd0d14eb47bfa0d3f63093db361014407a98f5ba973aa185e8fadede1

Contents?: true

Size: 755 Bytes

Versions: 3

Compression:

Stored size: 755 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)
        context   = smell.context
        message   = smell.message
        type      = smell.subclass

        Smell.new(:locations => locations, :context => context, :message => message, :type => type)
      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

3 entries across 3 versions & 1 rubygems

Version Path
rubycritic-0.0.9 lib/rubycritic/smell_adapters/reek.rb
rubycritic-0.0.8 lib/rubycritic/smell_adapters/reek.rb
rubycritic-0.0.7 lib/rubycritic/smell_adapters/reek.rb