Flex/Flash/Actionscript

Analyze your ActionScript code with this Apollo app

This is a little Apollo app I whipped up so I could analyze the Flex SDK source code. It analyzes actionscript code and produces some basic stats: number of files, breakdown of lines of code (comments versus whitespace versus real code), and it counts functions and variables. Not really useful for anything in real life, I was just curious how large the Flex SDK was, so I wanted a way to figure that out.

When it first loads it tries to locate the location of the Flex SDK source if it can find it on your computer. You can change that to scan whatever directory you want. Be aware it’s going to recursively loop over every subdirectory, and it you set it to scan your root folder it might hang for a while.

Oh, and a secret note: if you drag the bottom right corner of the app you can resize it.

So some stats just for fun:

Flex SDK: 287,661 lines of code
FlexLib: 17,885 lines of code
This Apollo app: 1,018 lines of code

Download the .air file here to install the Apollo app.

Some screenshots:
apolloapp1.jpg
apolloapp2.jpg
apolloapp3.jpg

Related:

  • I did a few calculations on the Flex SDK source code. By my count there are 788 files (.as or .mxml) for a total of 287,661 lines of code. Out of that, 87,216 lines are comments (about 30%). The top 5 biggest classes are: UIComponent (8,407 lines), ListBase (7,414 lines),…
    Tags: lines, code, source, flex, sdk, apollo, app
  • UPDATE: Well shit, turns out that posting the source of the almost-open-source-but-not-quite-yet Flex SDK is a no-no for now. I assume once the Flex 3 SDK officially goes open source this will be OK, but for now I've been asked by Adobe to take it down. As you say master.…
    Tags: sdk, flex, source, code
  • I want to start off with a quick recap of the current status of the bug I wrote about a few days ago. The Flex 3 Panel bug that resulted in the content of a Panel overlapping the title bar of the Panel has been fixed. The fix will be…
    Tags: flex, sdk
Standard

29 thoughts on “Analyze your ActionScript code with this Apollo app

  1. Just for fun…

    Flash CS3’s Folder:

    Files: 574
    Lines of Code: 152,849
    Comment Lines: 54,099
    Whitespace Lines: 14,758

    The text in the app should be copy and pasteable!

    Also, I have some older AS that isn’t in classes in another project, and it seemingly doesn’tcount or see them, do the app require stuff to be in classes to be read?

  2. Luis Eduardo says:

    I dont think this is so useless. In fact, there are a companhy that i worked once that needed a tool very similar to this to count their total length of the code to win a… dont know the exactly word in english but… something like a contest of big companys to demonstrate certain points and win projects with that points. And amount of lines of codes was an item.
    Anyway, i use in my little project because i am curious like you ๐Ÿ˜‰ but not regard the Flex SDK, only in my own (1 year) project. Would be nice if we could change the extension of the files to .java, .php, and so on, even if we miss the function count… just my 2 cents.
    very good work bro! ๐Ÿ˜‰

  3. I agree with Luis that this is not so useless. This can be very helpful in determining size of an application. Lines of Code (LOC), according to many software estimation experts, are essential to estimating and communicating application size to stakeholders. If this were used properly and decent stats were collected over time, you would be able to estimate projects more accurately. My latest post at http://www.lane4interactive.com has a book review of “Software Estimation”. The book is worth reviewing.

    Nice work!

    – Tim O’Hare

  4. Pingback: tessekkur viene de tessekkur ederim Un poco de Apollo, un poco de as3, un poco de organizaciรณn «

  5. Eric Briscoe says:

    Doug,

    This application sound great. My organization requires us to perform monthly code metrics (i.e. source lines of code) on all of our projects. I had a utility I was using to count code in .as files but have now transitioned over to flex and was facing having to count lines of code by hand, or write a utility to do it – either of which I do not really have the time for.

    I downloaded your app, howerver, I get the following error when I try to open it in AIR:

    This application could not be installed or launched (AIR file C:\Documents and Settings\MCSUSER\Desktop\ASCodeAnalyzer2.air is invalid: This application requires a version of the Adobe Integrated Runtime (AIR) which is no longer supported. Please contact the application author for an updated version.).

    Is their anyway you could recompile this app to run under the latest version of AIR? Your help would be etremely appreciated.

    Thank you for your insights and dedication!

  6. Peter Vogel says:

    Doug,

    Looks awesome! I’m running into the same problem as Eric — any chance we can get an update?

    Great Blog by the way, thanks for sharing!

    Thanks!
    Peter+

  7. Doug,

    I echo the sentiment of others and wanted to thank you for sharing!

    I also would love to either have an update, or access to source so I could compile with the current player.

  8. Wow, ok, with the recent surge in interest about getting this to run under Air beta 3, I’m going to look into that in the next few weeks. Hopefully that also means releasing the source for the app.

  9. Wow, that looks cool.

    Any idea if you’re going to update? I’ve been using a super lame JScript I wrote to get the basics, but your app would work much better ๐Ÿ™‚

    Cheers, and thanks!

  10. I agree with Luis that this is not so useless. This can be very helpful in determining size of an application. Lines of Code (LOC), according to many software estimation experts, are essential to estimating and communicating application size to stakeholders.

  11. cimmicola says:

    Hi boss, this air file can not be installed in air runtime 1.1. would you please update your installation air file?
    that’s would be thankful

  12. Ah been looking for an app like this for a long time, PLEASE UPDATE!!!!

    Hell I’ll update it for you if you give me the source =P

    Great work though!

  13. John Kline says:

    This looks great, but still can’t use it with the current version of AIR. Any idea when/if you will update this? Hopefully soon! Thanks Doug!

  14. Pingback: ActionScript/Flex/AIR Code Quality Measurement Tools « Jai’s Weblog – Tech, Security & Fun…

  15. @Doug – Any chance you can make the source available for this? It’d be cool to see what steps you took to get the stats Apollo is generating; maybe even upgrade it into a complexity analysis tool like JavaNCSS (using some of the work from FlexCover). Getting a complexity report that works with Sonar and Hudson would be nice. What do you think?

  16. kanu kukreja says:

    getting error ๐Ÿ™
    This application requires an update to Adobe AIR that is not available for your system.

    Please view the system requirements for Adobe AIR and update your system accordingly.

  17. Marcus says:

    Hey, I really need this. Like other people I would be happy to update it for you – it looks like a perfect piece of kit. You have my email xD

  18. Hi folks,

    Here is a brand new tool that RichAnalysis wants to share with you : RichCodeAnalyser.

    The aim off RichCodeAnalyser is to let you see usefull statistics about your code. With this tool, you can see if a class has too many methods, to few comments or no blanks at all. Further more, you can analyse the amount of public, privates, etc. methods or variables. You can see these data either for the entire folder or for just a package, or even a class. Finaly, you can export an HTML report and share it whithin you team.

    To discover RichCodeAnalyser, go to the RichAnalysis blog :

    http://www.richanalysis.net/richcodeanalyser

    Let us know what you think about RichCodeAnalyser !

  19. Federico says:

    Thank you very much Phiphou, that RichCodeAnalyzer runs great!
    I couldn’t install Doug’s analyzer because some AIR version problem, but I found what I needed in that last comment, so thanks Doug too for this site.

  20. Pingback: Are there any good programs for actionscript/flex that’ll count lines of code, number of functions, files, packages,etcโ€ฆ « « Programmers Goodies Programmers Goodies

Comments are closed.