あるの良いプログラムのためのactionscript/フレックスだ数行のコード番号機能ファイルのパッケージなど

StackOverflow https://stackoverflow.com/questions/35541

質問

Dougン=れまでに作成したものだというよう必要なhttp://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/ がalas-たので空気ベータ2.僕らの一部のツールできたらいいのに施設まで格安料金プランを提供する歯の部分メトリクス...あらゆるアイデアなの?

役に立ちましたか?

解決

あるコードメトリックExplorerにおける企フレックスのプラグイン。

http://www.deitte.com/archives/2008/09/flex_builder_pl.htm

他のヒント

簡単なツールとして LocMetrics ができます。ファイルとしても---

または

find . -name '*.as' -or -name '*.mxml' | xargs wc -l

またはご利用の場合はzsh

wc -l **/*.{as,mxml}

なんだか分の行はコメントは、空白行がんに最も人気のあるものをどのようプロジェクトと異なっても、すで書いてのものを用意してお待ちしており、有用な指標において

この小さなスクリプトを書いての総数発生のための異なるソースコードの要素をActionScript3コード(これはPythonで記述されてないな、Perlろうが適してa regex-正規表現の重スクリプトこのような):

#!/usr/bin/python

import sys, os, re

# might want to improve on the regexes used here
codeElements = {
'package':{
    'regex':re.compile('^\s*[(private|public|static)\s]*package\s+([A-Za-z0-9_.]+)\s*', re.MULTILINE),
    'numFound':0
    },
'class':{
    'regex':re.compile('^\s*[(private|public|static|dynamic|final|internal|(\[Bindable\]))\s]*class\s', re.MULTILINE),
    'numFound':0
    },
'interface':{
    'regex':re.compile('^\s*[(private|public|static|dynamic|final|internal)\s]*interface\s', re.MULTILINE),
    'numFound':0
    },
'function':{
    'regex':re.compile('^\s*[(private|public|static|protected|internal|final|override)\s]*function\s', re.MULTILINE),
    'numFound':0
    },
'member variable':{
    '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),
    'numFound':0
    },
'todo note':{
    'regex':re.compile('[*\s/][Tt][Oo]\s?[Dd][Oo][\s\-:_/]', re.MULTILINE),
    'numFound':0
    }
}
totalLinesOfCode = 0

filePaths = []
for i in range(1,len(sys.argv)):
    if os.path.exists(sys.argv[i]):
        filePaths.append(sys.argv[i])

for filePath in filePaths:
    thisFile = open(filePath,'r')
    thisFileContents = thisFile.read()
    thisFile.close()
    totalLinesOfCode = totalLinesOfCode + len(thisFileContents.splitlines())
    for codeElementName in codeElements:
        matchSubStrList = codeElements[codeElementName]['regex'].findall(thisFileContents)
        codeElements[codeElementName]['numFound'] = codeElements[codeElementName]['numFound'] + len(matchSubStrList)

for codeElementName in codeElements:
    print str(codeElements[codeElementName]['numFound']) + ' instances of element "'+codeElementName+'" found'
print '---'
print str(totalLinesOfCode) + ' total lines of code'
print ''

パスパスのすべてのソースコードファイルのプロジェクト引数としてこのスクリプトに開発することで全ての合計とは必ずしも一致しない。

コマンドのようになります:

find /path/to/project/root/ -name "*.as" -or -name "*.mxml" | xargs /path/to/script

出力のようなこと:

1589 instances of element "function" found
147 instances of element "package" found
58 instances of element "todo note" found
13 instances of element "interface" found
2033 instances of element "member variable" found
156 instances of element "class" found
---
40822 total lines of code

CLOC- http://cloc.sourceforge.net/.でもWindowsのコマンドラインに基づく、作品とAS3.0は、本アプリケーションは、すで記述されています。●ここでは、BATファイルの設定を使用してい:

REM =====================

echo off

cls

REM set variables

set ASDir=C:\root\directory\of\your\AS3\code\

REM run the program

REM See docs for different output formats.

cloc-1.09.exe --by-file-by-lang --force-lang="ActionScript",as --exclude_dir=.svn --ignored=ignoredFiles.txt --report-file=totalLOC.txt %ASDir% 

REM show the output

totalLOC.txt

REM end

pause

REM =====================

取得合計が、常に走行 find . -type f -exec cat {} \; | wc -l プロジェクトディレクトリを使用している場合、Mac OS Xで動作します。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top