🕷 zenspider.com

by ryan davis



sitemap
Looking for the Ruby Quickref?

Flog readability enhancements

Published 2009-03-16 @ 18:38

Tagged flog, ruby

I’ve got some flog readability enhancements coming in the next release of flog. Check it:

Old Way:

  % flog -q lib
  Total Flog = 1097.2 (17.4 flog / method)
  FlogGauntlet#display_report: (202.1)
  Flog#output_details: (85.3)
  FlogGauntlet#score_for: (65.9)
  Flog#process_iter: (61.9)
  Flog#parse_options: (53.7)
  Flog#flog: (41.2)
  Flog#none: (36.5)
  FlogGauntlet#group_by_owner: (27.7)
  FlogGauntlet#report_bad_people: (26.8)
  FlogTask#define: (24.0)
  Flog#output_method_details: (23.2)
  Flog#score_method: (22.1)

It works. I guess… But it sucks. Why? Because I can’t quickly read the thing and I can’t use UNIX tools on it easily. And -q not being the default just didn’t make sense. The details were overkill until you were digging in and trying to clean stuff up. So that is enabled with –details and –quite is default.

New Way:

There are two ways to do it now:

Vanilla:

  % flog lib
    1115.2: flog total
      17.7: flog/method average
  
     202.1: FlogGauntlet#display_report
      85.3: Flog#output_details
      65.9: FlogGauntlet#score_for
      61.9: Flog#process_iter
      53.7: Flog#parse_options
      41.2: Flog#flog
      36.5: Flog#none
      27.7: FlogGauntlet#group_by_owner
      26.8: FlogGauntlet#report_bad_people
      24.0: FlogTask#define
      23.2: Flog#output_method_details
      22.1: Flog#score_method

pretty, no?

With Grouping:

  % flog -g lib
    1115.2: flog total
      17.7: flog/method average
  
     323.8: Flog total
      85.3: Flog#output_details
      61.9: Flog#process_iter
      53.7: Flog#parse_options
      41.2: Flog#flog
      36.5: Flog#none
      23.2: Flog#output_method_details
      22.1: Flog#score_method
  
     322.6: FlogGauntlet total
     202.1: FlogGauntlet#display_report
      65.9: FlogGauntlet#score_for
      27.7: FlogGauntlet#group_by_owner
      26.8: FlogGauntlet#report_bad_people
  
      24.0: FlogTask total
      24.0: FlogTask#define