class MetricFu::HotspotAnalyzer
Constants
- COMMON_COLUMNS
- GRANULARITIES
Public Class Methods
new(result_hash)
click to toggle source
# File lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb, line 20 def initialize(result_hash) # we can't depend on the result # returning a parsed yaml file as a hash? result_hash = YAML::load(result_hash) if result_hash.is_a?(String) setup(result_hash) end
Public Instance Methods
analyzed_problems()
click to toggle source
# File lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb, line 31 def analyzed_problems @analyzed_problems = MetricFu::HotspotAnalyzedProblems.new(@rankings, @analyzer_tables) end
hotspots()
click to toggle source
# File lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb, line 27 def hotspots analyzed_problems.worst_items end
tool_analyzers()
click to toggle source
# File lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb, line 16 def tool_analyzers MetricFu::Hotspot.analyzers end
Private Instance Methods
setup(result_hash)
click to toggle source
TODO clarify each of these steps in setup extract into its own method remove unnecessary constants, turn into methods
# File lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb, line 41 def setup(result_hash) # TODO There is likely a clash that will happen between # column names eventually. We should probably auto-prefix # them (e.g. "roodi_problem") analyzer_columns = COMMON_COLUMNS + GRANULARITIES + tool_analyzers.map(&:columns).flatten # though the tool_analyzers aren't returned, they are processed in # various places here, then by the analyzer tables # then by the rankings # to ultimately generate the hotspots @analyzer_tables = MetricFu::AnalyzerTables.new(analyzer_columns) tool_analyzers.each do |analyzer| analyzer.generate_records(result_hash[analyzer.name], @analyzer_tables.table) end @analyzer_tables.generate_records @rankings = MetricFu::HotspotRankings.new(@analyzer_tables.tool_tables) @rankings.calculate_scores(tool_analyzers, GRANULARITIES) # TODO does it not need to return something here? analyzed_problems end