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



922
923
924
925
926
# File 'lib/saikuro.rb', line 922

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



902
903
904
905
# File 'lib/saikuro.rb', line 902

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

#end_class_compute_state(name) ⇒ Object



917
918
919
920
# File 'lib/saikuro.rb', line 917

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

#start(new_out = nil) ⇒ Object



894
895
896
897
898
899
900
# File 'lib/saikuro.rb', line 894

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



907
908
909
910
911
912
913
914
915
# File 'lib/saikuro.rb', line 907

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