[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Since pmccabe
does not factor code length into its score, some folks
have taken to saying either long functions or a high McCabe score find
functions requiring attention. But it means looking at two factors
without any visibility into how the length is obfuscating the code.
The technique used by this program is to count 1 for each line that a
statement spans, plus the complexity score of control expressions
(for
, while
, and if
expressions). The value for
a block of code is the sum of these multiplied by a nesting factor
(see section nesting-penalty option (-n)). This score is then added to the
score of the encompassing block. With all other things equal, a
procedure that is twice as long as another will have double the score.
pmccabe
scores them identically.
This document was generated by Bruce Korb on May 15, 2011 using texi2html 1.82.