flogger: unit test your flog scores

Flog is a simple ABC metric (Assignments, Branches, Calls) for ruby code. It gives you a hint on size and complexity of your code. How to interprete your flog scores is a bit difficult. As usual in Software Engineering: ‘it depends’.

Jake Scruggs interpretes the values like this:

  • 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



(and smarticus says that a score of 60+ means ‘WTF are you doing’).



So how can you integrate this in your continous integration environment? Or just your in your unit tests?
Enter flogger:



def test_flog_scores()
assert_flog(’somefile.rb’)
end



Flogger just adds an assert_flog() assertion which you can use in your unit tests. Simple.


Find more in the README

back

Leave a Reply