Sha256: fbc6db876563fcecb37f67b2117d5804f30172e97fee884507a1eb2681f8e608

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

require 'reek'
module AnalDiffist
  class ReekParser
    attr_accessor :problems

    def initialize(paths)
      examiner = Reek::Examiner.new(paths)
      @problems = examiner.smells.map {|smell| ReekProblem.new(smell)}
    end

    def diff(previous)
      AnalDiffist::DiffSet.new(previous.problems, self.problems)
    end
  end

  class ReekProblem
    def initialize smell
      @smell = smell
    end

    def type
      @smell.subclass.to_s || ''
    end

    def context
      @smell.location["context"]
    end

    def diff other
      self if other.nil?
    end
    def score
      1
    end
    def description
      "Reek: #{type}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
analdiffist-0.2.0 lib/analdiffist/reek_parser.rb