On Aug 23, 2007, at 13:33, Thomas Metge wrote:
> Thomas Metge wrote:
>> Chad Perrin wrote:
>>> On Tue, Aug 21, 2007 at 05:05:33PM +0900, Ryan Davis wrote:
>>>
>>>> flog version 1.1.0 has been released!
>>>>
>>>> * <http://ruby.sadi.st/>
>>>> * <http://rubyforge.org/projects/seattlerb>
>>>>
>>>> Flog reports the most tortured code in an easy to read pain
>>>> report. The higher the score, the more pain the code is in.
>>>>
>>>>     % ./bin/flog bin/flog
>>>>     Total score = 128.7
>>>>
>>>
>>> So . . . is that a good result, or a bad result?  How do you define
>>> "pain" in this context?  Judging by the website, it looks like  
>>> uses of
>>> eval qualify as "pain" -- which seems like an odd metric.
>>>
>>>
>>>
>>>>     Flog#report: (21)
>>>>          4: puts
>>>>          2: sort_by
>>>>     ...
>>>>
>>>
>>> So . . . is "puts" a "painful" method, then?
>>>
>>>
>>
>> good point... flog looks like a great tool, but what is a "good"  
>> score and a "bad" score?
>>
>> tom
>>
>>
> never mind... i think i'm catching on (at last)... this is  
> extremely useful for pointing out painful parts of your code, not  
> necessarily giving a relevant final score.

Here's a few examples from RubyGems trunk:

Total score = 9491.3018782491
Server#run: (184.2)
PristineCommand#execute: (136.1)
Policy#verify_gem: (135.9)
InstallCommand#execute: (123.0)
HelpCommand#execute: (116.6)
DependencyCommand#execute: (115.9)
CertCommand#initialize: (110.0)
TarOutput#open_from_io: (106.8)
Validator#alien: (105.8)
Gem#activate: (105.0)
UpdateCommand#execute: (99.3)
EnvironmentCommand#execute: (95.7)
TarInput#initialize: (95.3)
CleanupCommand#execute: (94.7)
SourcesCommand#execute: (94.6)
MirrorCommand#execute: (89.9)

As you can see, #execute for various commands have high flog scores.   
I'd really prefer the commands to be nothing more than lightweight  
glue methods that simply dispatch to concrete classes to do all the  
work, as that approach maximizes reuse.

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars