Matisse Enzer wrote:
On Dec 15, 2006, at 10:13 PM, Chris Dolan wrote:
OK, I see. Perhaps I was distracted from your main point by mention
of cyclomatic complexity, which has a rather specific definition.
Mea culpa.
In the next release I will change the documentation for
Perl::Metrics::Simple to make clear how exactly the complexity score is
calculated, and that it is only an approximation of true cyclomatic
complexity.
Meanwhile, I am open to making the measurement more useful. For example,
should
if ($a eq $b)
or
if ( $a == $b )
be counted as more complex than:
if ( $a )
?
I don't think so. The latter is simply an implicit version of the
former. It means something like:
if ( $a == $true_value || $a eq $true_value )
Another way of looking at it is that comparison operators are no
different than any other expressions.
if ( func() )
if ( --$a )
The expressions themselves do not represent branches. They just produce
values that may be used as the basis for a branch.
Randy.