<p>Doug McCune had created something that was exactly what I needed (<a href="http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/" rel="nofollow noreferrer">http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/</a>) but alas - it was for AIR beta 2.  I just would like some tool that I can run that would provide some decent metrics...any idea's?</p>

[{'answer_id': 35552, 'author': 'hoyhoy', 'author_id': 3499, 'author_profile': 'https://Stackoverflow.com/users/3499', 'pm_score': 0, 'selected': False, 'text': "<p>To get a rough estimate, you could always run <code>find . -type f -exec cat {} \\; | wc -l</code> in the project directory if you're using Mac OS X. </p>\n"}, {'answer_id': 35787, 'author': 'Theo', 'author_id': 1109, 'author_profile': 'https://Stackoverflow.com/users/1109', 'pm_score': 1, 'selected': False, 'text': "<p>Or</p>\n\n<pre><code>find . -name '*.as' -or -name '*.mxml' |\xa0xargs wc -l\n</code></pre>\n\n<p>Or if you use zsh</p>\n\n<pre><code>wc -l **/*.{as,mxml}\n</code></pre>\n\n<p>It won't give you what fraction of those lines are comments, or blank lines, but if you're only interested in how one project differs from another and you've written them both, it's a useful metric.</p>\n"}, {'answer_id': 38575, 'author': 'hasseg', 'author_id': 4111, 'author_profile': 'https://Stackoverflow.com/users/4111', 'pm_score': 1, 'selected': False, 'text': '<p>Here\'s a small script I wrote for finding the total numbers of occurrence for different source code elements in ActionScript 3 code (this is written in Python simply because I\'m familiar with it, while Perl would probably be better suited for a regex-heavy script like this):</p>\n\n<pre><code>#!/usr/bin/python\n\nimport sys, os, re\n\n# might want to improve on the regexes used here\ncodeElements = {\n\'package\':{\n    \'regex\':re.compile(\'^\\s*[(private|public|static)\\s]*package\\s+([A-Za-z0-9_.]+)\\s*\', re.MULTILINE),\n    \'numFound\':0\n    },\n\'class\':{\n    \'regex\':re.compile(\'^\\s*[(private|public|static|dynamic|final|internal|(\\[Bindable\\]))\\s]*class\\s\', re.MULTILINE),\n    \'numFound\':0\n    },\n\'interface\':{\n    \'regex\':re.compile(\'^\\s*[(private|public|static|dynamic|final|internal)\\s]*interface\\s\', re.MULTILINE),\n    \'numFound\':0\n    },\n\'function\':{\n    \'regex\':re.compile(\'^\\s*[(private|public|static|protected|internal|final|override)\\s]*function\\s\', re.MULTILINE),\n    \'numFound\':0\n    },\n\'member variable\':{\n    \'regex\':re.compile(\'^\\s*[(private|public|static|protected|internal|(\\[Bindable\\]))\\s]*var\\s+([A-Za-z0-9_]+)(\\s*\\\\:\\s*([A-Za-z0-9_]+))*\\s*\', re.MULTILINE),\n    \'numFound\':0\n    },\n\'todo note\':{\n    \'regex\':re.compile(\'[*\\s/][Tt][Oo]\\s?[Dd][Oo][\\s\\-:_/]\', re.MULTILINE),\n    \'numFound\':0\n    }\n}\ntotalLinesOfCode = 0\n\nfilePaths = []\nfor i in range(1,len(sys.argv)):\n    if os.path.exists(sys.argv[i]):\n        filePaths.append(sys.argv[i])\n\nfor filePath in filePaths:\n    thisFile = open(filePath,\'r\')\n    thisFileContents = thisFile.read()\n    thisFile.close()\n    totalLinesOfCode = totalLinesOfCode + len(thisFileContents.splitlines())\n    for codeElementName in codeElements:\n        matchSubStrList = codeElements[codeElementName][\'regex\'].findall(thisFileContents)\n        codeElements[codeElementName][\'numFound\'] = codeElements[codeElementName][\'numFound\'] + len(matchSubStrList)\n\nfor codeElementName in codeElements:\n    print str(codeElements[codeElementName][\'numFound\']) + \' instances of element "\'+codeElementName+\'" found\'\nprint \'---\'\nprint str(totalLinesOfCode) + \' total lines of code\'\nprint \'\'\n</code></pre>\n\n<p>Pass paths to all of the source code files in your project as arguments for this script to get it to process all of them and report the totals.</p>\n\n<p>A command like this:</p>\n\n<pre><code>find /path/to/project/root/ -name "*.as" -or -name "*.mxml" | xargs /path/to/script\n</code></pre>\n\n<p>Will output something like this:</p>\n\n<pre><code>1589 instances of element "function" found\n147 instances of element "package" found\n58 instances of element "todo note" found\n13 instances of element "interface" found\n2033 instances of element "member variable" found\n156 instances of element "class" found\n---\n40822 total lines of code\n</code></pre>\n'}, {'answer_id': 145362, 'author': 'Brandon', 'author_id': 23133, 'author_profile': 'https://Stackoverflow.com/users/23133', 'pm_score': 3, 'selected': True, 'text': '<p>There is a Code Metrics Explorer in the Enterprise Flex Plug-in below:</p>\n\n<p><a href="http://www.deitte.com/archives/2008/09/flex_builder_pl.htm" rel="nofollow noreferrer">http://www.deitte.com/archives/2008/09/flex_builder_pl.htm</a></p>\n'}, {'answer_id': 146201, 'author': 'Borek Bernard', 'author_id': 21728, 'author_profile': 'https://Stackoverflow.com/users/21728', 'pm_score': 2, 'selected': False, 'text': '<p>Simple tool called <a href="http://www.locmetrics.com/" rel="nofollow noreferrer">LocMetrics</a> can work for .as files too...</p>\n'}, {'answer_id': 2723668, 'author': 'Delfeld', 'author_id': 327120, 'author_profile': 'https://Stackoverflow.com/users/327120', 'pm_score': 1, 'selected': False, 'text': '<p>CLOC - <a href="http://cloc.sourceforge.net/" rel="nofollow noreferrer">http://cloc.sourceforge.net/</a>.  Even though it is Windows commandline based, it works with AS3.0, has all the features you would want, and is well-documented.  Here is the BAT file setup I am using:</p>\n\n<pre><code>REM =====================\n\necho off\n\ncls\n\nREM set variables\n\nset ASDir=C:\\root\\directory\\of\\your\\AS3\\code\\\n\nREM run the program\n\nREM See docs for different output formats.\n\ncloc-1.09.exe --by-file-by-lang --force-lang="ActionScript",as --exclude_dir=.svn --ignored=ignoredFiles.txt --report-file=totalLOC.txt %ASDir% \n\nREM show the output\n\ntotalLOC.txt\n\nREM end\n\npause\n\nREM =====================\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/35541', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3435/']