Class: Hashira::Report::ComplexityTable

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

Constant Summary collapse

TOP =
10
METHOD_HEADERS =
%w[method Cog Calls Loc].freeze
CLASS_HEADERS =
%w[class Cog Methods Peak].freeze
METHOD_TITLE =
"Cognitive complexity — worst methods (Cog = how hard to read, Calls = message sends)"
CLASS_TITLE =
"Per-class rollup (Cog total survives extract-method; Peak is the worst method it hides)"

Instance Method Summary collapse

Constructor Details

#initialize(complexity, top: TOP, io: $stdout) ⇒ ComplexityTable

Returns a new instance of ComplexityTable.



10
11
12
13
14
# File 'lib/hashira/report/complexity_table.rb', line 10

def initialize(complexity, top: TOP, io: $stdout)
  @complexity = complexity
  @top = top
  @io = io
end

Instance Method Details



16
17
18
19
# File 'lib/hashira/report/complexity_table.rb', line 16

def print
  section(@complexity.ranked, METHOD_HEADERS, METHOD_TITLE)
  section(@complexity.classes, CLASS_HEADERS, CLASS_TITLE)
end