On Dec 15, 2006, at 7:52 AM, Chris Dolan wrote:
That can't be right. Negation does not contribute to complexity.
I think it is fair to say, that to a human, negation *can* increase complexity:
if ( $foo ) { # do something } is a little bit easier to understand than: if ( ! $foo ) { # do something }
Instead, I believe it is the for loop and the exit points that are increasing your count.
It certainly is possible to create a better, more sophisticated measure of cyclomatic complexity - and I think you are probably right, or at least "more right" in the way you are suggesting complexity be counted. Perl::Metrics::Simple simply gives one "point" for each of the following:
qw( ! && || ||= &&= or and xor not ? <<= >>= ); qw( for foreach goto if else elsif last next unless until while ); See the measure_complexity() method in Perl::Metrics::Simple::Analysis::File ------------------------------------------------------- Matisse Enzer <[EMAIL PROTECTED]> http://www.matisse.net/ - http://www.eigenstate.net/