8 Dec 14:27
Re: FW: Code and block size as complexity metrics
Rob Kinyon <rob.kinyon <at> gmail.com>
2004-12-08 13:27:36 GMT
2004-12-08 13:27:36 GMT
http://www.perlmonks.org/?node_id=413087 has a discussion of Cylcomatic Complexity, which seems to be exactly what we're trying to do here ... On Wed, 24 Nov 2004 13:20:57 +1100, Adam Kennedy <adam <at> phase-n.com> wrote: > > I've got the basic tokens/block thing going in an exploration script. > > One thing I'm noticing is that find() flattens out your parse-tree. > > Having the ability to access the parent-node may end up being nice, > > but I'm still feeling my way through the problem-space, so don't code > > anything based on what I say just yet. > > It doesn't flatten it out as such, it just returned a list of pointers > to the various elements you asked for in the tree. > > http://search.cpan.org/~adamk/PPI-0.831/lib/PPI/Element.pm > > The tree itself still exists and is not modified, and you can still call > any of the "going up the tree" methods. > > $Element->parent # Immediate parent > $Element->top # Top of the PDOM tree (should be a ::Document) > $Element->statement # Parent statement > > > Some documentation on what "significant" means would be nice. Also, if > > significant() and prune() could play together, that would be cool. I'm > > finding I like to do something like: > > > > my $doc = PPI::Document->read( $filename ); > > $doc->prune( "PPI::Token::$_" ) for qw( Comment Whitespace ); >(Continue reading)
RSS Feed