views:

65

answers:

2

I am aware of the FlexCover project, but I want a code analyzer that finds the functions (and classes, I suppose) that have no calls to them at all in the source code.

I suppose I could comment them out one-by-one, but that way lies madness.

It's more than just tidiness: we have many versions of the same functionality and maintaining un-needed versions prevents us from getting rid over several classes and protocols that Really Need To Go Away.

Thanks

A: 

For C there is a program ncc which produces some intermediate files which contains for each function a list of all variables accessed as well as functions called. Using that information you can generate a call tree (I once parsed those files to find the (approximate) maximum stack usage (together with information from the map file)).

While ncc is for C, you should be able to use the same principle. You can download and have a look at how it is done for ncc, or maybe you can search for "generate call tree" together with flex or actionscript to see if you find some useful tool. When you have a complete call tree, any function not part of it is a strong candidate for removal.

hlovdal
I didn't want to build this tool; I want to use one that exists.Thank you for the advice if I have to DIY
Richard Haven
+1  A: 

You might find this helpful:

http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD

Good luck.

t3hh00d
Viewing the results through an SWF can be a little annoying though, and I'm not using Maven, or Hudson, so I modified an XSLT file from the PMD project (the Java one) so that it would generate HTML. You can see that post here: http://forums.adobe.com/message/2299684#2299684
t3hh00d
It looks great, but I'm still trying to figure out how to install it. The Eclipse plug-in will be much more my speed.Thanks
Richard Haven
Np. What operating system are you on?
t3hh00d
The Eclipse plug-in works great
Richard Haven