Class: Saikuro::StateHTMLComplexityFormater

Inherits:
ParseStateFormater show all
Includes:
HTMLStyleSheet
Defined in:
lib/saikuro/state_html_complexity_formater.rb

Instance Attribute Summary

Attributes inherited from BaseFormater

#current, #errors, #warnings

Instance Method Summary collapse

Methods included from HTMLStyleSheet

style_sheet, #style_sheet

Methods inherited from BaseFormater

#initialize, #reset_data, #warn_error?

Constructor Details

This class inherits a constructor from Saikuro::BaseFormater

Instance Method Details

#def_compute_state(name, complexity, lines) ⇒ Object



33
34
35
36
37
# File 'lib/saikuro/state_html_complexity_formater.rb', line 33

def def_compute_state(name, complexity, lines)
  return if @filter.ignore?(complexity)
  klass = warn_error?(complexity, name)
  @out.puts "<tr><td>#{name}</td><td#{klass}>#{complexity}</td><td>#{lines}</td></tr>"
end

#endObject



13
14
15
16
# File 'lib/saikuro/state_html_complexity_formater.rb', line 13

def end
  @out.puts "</body>"
  @out.puts "</html>"
end

#end_class_compute_state(name) ⇒ Object



28
29
30
31
# File 'lib/saikuro/state_html_complexity_formater.rb', line 28

def end_class_compute_state(name)
  @out.puts "</table>"
  @out.puts "</div>"
end

#start(new_out = nil) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/saikuro/state_html_complexity_formater.rb', line 5

def start(new_out=nil)
  reset_data
  @out = new_out if new_out
  @out.puts "<html><head><title>Cyclometric Complexity</title></head>"
  @out.puts style_sheet
  @out.puts "<body>"
end

#start_class_compute_state(type_name, name, complexity, lines) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/saikuro/state_html_complexity_formater.rb', line 18

def start_class_compute_state(type_name,name,complexity,lines)
  @current = name
  @out.puts "<div class=\"class_complexity\">"
  @out.puts "<h2 class=\"class_name\">#{type_name} : #{name}</h2>"
  @out.puts "<div class=\"class_total_complexity\">Total Complexity: #{complexity}</div>"
  @out.puts "<div class=\"class_total_lines\">Total Lines: #{lines}</div>"
  @out.puts "<table width=\"100%\" border=\"1\">"
  @out.puts "<tr><th>Method</th><th>Complexity</th><th># Lines</th></tr>"
end