The McCabe Cyclomatic Complexity metric (which counts the number of different executable paths through a module) proves to be an excellent measure of code quality. The more paths through a program, the more complicated it is, and the more bugs the program is likely to have.
http://www.enerjy.com/blog/?p=198