Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
Supercharge your skills with expert-authored tech & creative training. Unlimited. Online. Get it now →
December 28, 2009

Ruby, Emacs & Flog Metrics


One hour screencast.

Only $12!

More info…

Flog metrics are often difficult to understand. The numbers can’t be compared between projects or even classes. This editor enhancement helps by showing the flog score in the left column as you code.
Flog Score in the Column
This method has a flog score of 22 which can be seen in the column. It’s more meaningful if compared to the scores of other methods in the same class. Larger numbers indicate greater complexity. If one method has a score that is significantly larger than others, it should probably be broken apart into several methods.
Repeated OR
The method repeats a conditional inline many times in the options. Refactoring the optional default value into the metadata method simplifies it and reduces the flog score in real time. (See the screencast linked above.)
You’ll need


(sudo gem install flog). The


to flog is also available in several SCMs.


Get the code


Gary Bernhardt

wrote the initial Python implementation for Vim and posted a


that shows it in action. Ignas Mikalajunas


it to Emacs. I used numbers instead of colors since flog scores aren’t absolute (it would be hard to calibrate numbers to colors).

About the Author

is VP of Open Source at Pluralsight. He previously founded PeepCode and is an all around entrepreneur, developer, designer, teacher and athlete. Follow him on Twitter at @topfunky.