Sha256: 08be58934ad920080e0af4f544722d5d5112d06c01d3eb6d8555fa6c3c8bb0f6

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 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.map do |file_line|
          Location.new(file_path, file_line)
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubycritic-0.0.4 lib/rubycritic/smell_adapters/reek.rb
rubycritic-0.0.3 lib/rubycritic/smell_adapters/reek.rb
rubycritic-0.0.2 lib/rubycritic/smell_adapters/reek.rb
rubycritic-0.0.1 lib/rubycritic/smell_adapters/reek.rb