Class: Moult::Report::Hotspot

Inherits:
Object
  • Object
show all
Defined in:
lib/moult/report.rb

Overview

One ranked file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, score:, complexity:, churn:, methods:, confidence: nil, category: nil) ⇒ Hotspot

Returns a new instance of Hotspot.

Parameters:

  • path (String)

    path relative to the analysis root

  • score (Float)

    complexity x churn

  • complexity (Float)

    aggregate ABC for the file

  • churn (Integer)

    commits touching the file in the window

  • methods (Array<Method>)

    worst methods, highest ABC first



57
58
59
60
61
62
63
64
65
# File 'lib/moult/report.rb', line 57

def initialize(path:, score:, complexity:, churn:, methods:, confidence: nil, category: nil)
  @path = path
  @score = score
  @complexity = complexity
  @churn = churn
  @methods = methods
  @confidence = confidence
  @category = category
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



50
51
52
# File 'lib/moult/report.rb', line 50

def category
  @category
end

#churnObject (readonly)

Returns the value of attribute churn.



50
51
52
# File 'lib/moult/report.rb', line 50

def churn
  @churn
end

#complexityObject (readonly)

Returns the value of attribute complexity.



50
51
52
# File 'lib/moult/report.rb', line 50

def complexity
  @complexity
end

#confidenceObject (readonly)

Returns the value of attribute confidence.



50
51
52
# File 'lib/moult/report.rb', line 50

def confidence
  @confidence
end

#methodsObject (readonly)

Returns the value of attribute methods.



50
51
52
# File 'lib/moult/report.rb', line 50

def methods
  @methods
end

#pathObject (readonly)

Returns the value of attribute path.



50
51
52
# File 'lib/moult/report.rb', line 50

def path
  @path
end

#scoreObject (readonly)

Returns the value of attribute score.



50
51
52
# File 'lib/moult/report.rb', line 50

def score
  @score
end

Instance Method Details

#to_hObject



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/moult/report.rb', line 72

def to_h
  {
    path: path,
    score: score,
    complexity: complexity,
    churn: churn,
    confidence: confidence,
    category: category,
    methods: methods.map(&:to_h)
  }
end

#worst_methodObject

The single worst method in the file, for table drill-down.



68
69
70
# File 'lib/moult/report.rb', line 68

def worst_method
  methods.first
end