Free Screencast:
Desktop
iPod/Apple TV
Learn Emacs!
One hour screencast.
Only $9!
More info…
- Summary
- 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.)
- Requirements
-
You'll need
flog
(sudo gem install flog). The
source
to flog is also available in several SCMs.
- Code
-
→
Get the code
- Inspiration
-
Gary Bernhardt
wrote the initial Python implementation for Vim and posted a
screencast
that shows it in action. Ignas Mikalajunas
ported
it to Emacs. I used numbers instead of colors since flog scores aren't absolute (it would be hard to calibrate numbers to colors).