Would it be possible to add Halstead metrics
(n1,n2,N1,N2) into CCCC?
We have structural complexity with McCabe, and
information flow with Henry-Kafura, but nothing to
represent algorithmic/lexical complexity. These are all
pretty orthogonal measures.
I am not convinced that the choice of keywords for
McCabe (according to the documentation with 3.0-pre83,
I havent looked into the code yet) is necessarily a
good one.
It seems like they are chosen to reduced the score for
switch statements -- using 'switch' and 'break' instead
of 'case'.
'break' can appear in other places (prematurely exiting
other loops). It could be argued that this is counts
to structural complexity -- but then you would have to
include 'continue' and 'goto'. 'breaks' from loops
would typically be used in conjunction with another
branching operation, 'if'.
If the complexity of a list of 'case' statements,
leading to one functional section, is undesirable, then
there are other constructs available which may be
easier to maintain (is-in-list).
And what about the situation where run-on case
statements are set up to accumulate operations? For
example:
switch (a)
case 0 : foo ();
case 1 : bar ();
case 2 : doh ();
default : ray ();
}
This may be structurally ugly code, but then this is
what McCabe should be highlighting.
Also, shouldnt '?' be included as a decision point
('?:' construct).
Cheers,
Simon.