December 28, 2009
Ruby, Emacs & Flog MetricsBy Geoffrey Grosenbach
One hour screencast.
- 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.