What's a Good Flog Score?
I've been using Flog to measure the complexity of my Ruby code and I was wondering how others interpret Flog numbers. I'll go first with my opinions:
The highest Flog score I've seen in the wild was in the 300's. What's you're personal high and what do you think of my rankings?
In other news, I've redesigned the look of my blog so if you only see my post through a reader you might want to stop on by, take a look, and tell me what you think.
The 20 - 60 range is interesting to me. Sometimes the complexity of what you're doing will justify the score and other times the method is in desperate need of refactoring.
Score of Means
0-10 Awesome
11-20 Good enough
21-40 Might need refactoring
41-60 Possible to justify
61-100 Danger
100-200 Whoop, whoop, whoop
200 + Someone please think of the children
(note: these are scores for an individual method)
The highest Flog score I've seen in the wild was in the 300's. What's you're personal high and what do you think of my rankings?
In other news, I've redesigned the look of my blog so if you only see my post through a reader you might want to stop on by, take a look, and tell me what you think.
Comments
Ran Flog on our codebase. Top of the list:
OrderController#handle_payment: (524.2)
Scary!!
% time flog -n -m */dev/lib | head -25
Total Flog = 32364.8 (13.5 +/- 1057.1 flog / method)
RubyLexer#yylex: (1076.9)
Hoe#define_tasks: (587.2)
Context#debug_command: (498.0)
We've just published a gem which allows you to check your flog scores in unit tests.
http://blog.simplificator.com/2008/09/11/flogger-unit-test-your-flog-scores/
The test fails if your flog score is above 20. Of course you can customize this behaviour (if you run flog on the flogger gem then it will report scores > 20 :-) )
I think you are quite right to point to the 20-60 range as the grey area which strongly depends on your code domain and complexity of the project and requires someone experienced in that system domain to interpret properly.
My highest score across my five active projects so far is 50.4, but after refactoring just now is 33.5. They include 3 web apps (2x Rails, 1x Merb), a catch all internal Rails plugin and Twitter4R (raw Ruby library). Sorry for being boring in comparison to some that have already commented!
I am glad the Ruby community is finally getting on board with using metrics (as part of a holistic approach) to assist in managing software project risk. Coming from a heavy metrics background in Java/J2EE the last 4+ years in Ruby and Python have felt a little too much like the wild west, which has been fun, but perhaps it's time to grow up now!;)
Jake, glad to see people like you taking the metrics [integration] movement forward in the Ruby world. Thanks!
I think this is a pretty neat reality check against your code, but it's only useful if you understand the context of the numbers - lol - so thanks!