We've got several Flex projects, one of which has just been refactored. I'm wondering if there's an easy way to tell which classes and functions (if any) aren't being used any more?
I've discovered that we've definitely got some unused code, because running ASDoc on the entire project reports some compilation errors which don't get reported by Flex Builder (implying that those classes aren't being used any more). I'm hoping to find a more robust and complete method, and preferably one which can work at function level too.
My ugly hack:
Using the swfdump
tool from SWFtools, dump the disassembly from (all of) your swf(s):
swfdump -a my.swf > dump
Get a list of all your classes:
find . -name "*.as" -exec basename {} .as \; > classes
find . -name "*.mxml" -exec basename {} .mxml \; >> classes
Apply one list to the other:
for class in $(<classes) ; do grep -q \\\<$class\\\> dump || echo $class ; done
I am doing this on Windows, using Cygwin.
Check out the Flex PMD tool. It was recently released in beta, but we've been using it at work for a few weeks, and it seems to work pretty nicely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With