M. Edward (Ed) Borasky
11/17/2007 8:18:00 PM
Eric Hodel wrote:
> On Nov 16, 2007, at 21:53 , Austin Ziegler wrote:
>> I don't think that I'm really understanding the value of flog. Heckle, I
>> get. What am I supposed to do with a report like this:
>>
>> Total score = 2264.64752355478
>>
>> RGB#none: (486.2)
>> 169.4: freeze
>> 160.6: new
>> 135.5: lit_fixnum
>> 9.9: from_percentage
>> 6.0: sclass
>> 4.8: alias
>> [snippage]
>>
>> What does this really tell me?
>
> Total complexity of your project is 2264ish. 20% (486/2264) of your
> complexity lies in RGB, and I'm guessing that its all building up your
> constants (from the names in your report).
>
> What does `flog ... | grep -v '^ '` give (just the top-level stuff)
>
> For RubyGems:
>
> Total score = 7318.5427518653
>
> Server#run: (203.9)
> OpenURI#open_http: (161.0)
> Policy#verify_gem: (135.9)
> main#none: (118.0)
> Validator#alien: (105.8)
>
> Server#run is a good candidate for refactoring (3% of complexity!), as
> is Policy#verify_gem (2%!). main#none is just toplevel code. (OpenURI
> is in there for fixing proxy stuff :/)
>
> Note: values are an arbitrary, they only matter relative to the total,
> and relative to other modules or methods.
Ah ... so it's a "complexity profile". Couldn't flog display its report
with percentages and cumulative percentages? So, for your example, you'd
get:
Total 7318.54 Percent Cumulative
Server#run: 203.9 2.79% 2.79%
OpenURI#open_http: 161 2.20% 4.99%
Policy#verify_gem: 135.9 1.86% 6.84%
main#none: 118 1.61% 8.46%
Validator#alien: 105.8 1.45% 9.90%
...