您的位置:首页 > 编程语言

统计项目代码行数Count Lines of Code(CLOC)

2012-08-14 11:42 337 查看
统计代码总行数挺麻烦的 VS2010里虽然有Code Metrics Analyze 但这个工具只能用在托管的项目中 于是在这里找到一个小的命令行工具统计代码行数

用法很简单 如下(转自Wiki


How to use CLOC in Windows

(1) Download the program

(2) Open command prompt

(3) Run program with syntax: <exe program> <code file dir>

(4) Program will print out a table with statictics on every programming language it can recognise in the given directory

(5) -> SLOC is the amount of "code" lines

(6) -> LOC is the sum of "blank" + "comment" + "code" lines


Simple Example

cloc-1.08.exe D:\Users\temp\code_files\my_program
      21 text files.
      21 unique files.
       0 files ignored.
 http://cloc.sourceforge.net v 1.08  T=0.5 s (42.0 files/s, 9658.0 lines/s)
-------------------------------------------------------------------------------
Language          files     blank   comment      code    scale   3rd gen. equiv
-------------------------------------------------------------------------------
Java                 10       518       164      1979 x   1.36 =        2691.44
CSS                   3       129        28       739 x   1.00 =         739.00
PHP                   5       176       128       505 x   3.50 =        1767.50
HTML                  3        60        34       369 x   1.90 =         701.10
-------------------------------------------------------------------------------
SUM:                 21       883       354      3592 x   1.64 =        5899.04
-------------------------------------------------------------------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: