Class: StateHTMLComplexityFormater

Inherits:
ParseStateFormater show all
Includes:
HTMLStyleSheet
Defined in:
lib/saikuro.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 BaseFormater

Instance Method Details

#def_compute_state(name, complexity, lines) ⇒ Object



860
861
862
863
864
# File 'lib/saikuro.rb', line 860

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



840
841
842
843
# File 'lib/saikuro.rb', line 840

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

#end_class_compute_state(name) ⇒ Object



855
856
857
858
# File 'lib/saikuro.rb', line 855

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

#start(new_out = nil) ⇒ Object



832
833
834
835
836
837
838
# File 'lib/saikuro.rb', line 832

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



845
846
847
848
849
850
851
852
853
# File 'lib/saikuro.rb', line 845

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