Method: MetricFu::Reek#analyze

Defined in:
lib/generators/reek.rb

#analyzeObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/generators/reek.rb', line 43

def analyze
  @matches = @output.chomp.split("\n\n").map{|m| m.split("\n") }
  @matches = @matches.map do |match|
    file_path = match.shift.split('--').first
    file_path = file_path.gsub('"', ' ').strip
    code_smells = match.map do |smell|
      match_object = smell.match(REEK_REGEX)
      next unless match_object
      {:method => match_object[1].strip,
       :message => match_object[2].strip,
       :type => match_object[3].strip}
    end.compact
    {:file_path => file_path, :code_smells => code_smells}
  end
end