源码统计工具cloc

在有福那里看到了一个源码统计工具,貌似看上去挺简洁方便的,正好用用

http://sourceforge.net/projects/cloc/

可是坑爹的是,龟速,原因都懂的

直接brew进行安装

lihuideMacBook-Pro:Downloads lihui$ brew install cloc
==> Downloading https://downloads.sourceforge.net/project/cloc/cloc/v1.62/cloc-1.62.pl
#########                                                                 13.7%^C

一样的道理,因为也是从sourceforge来download

这里有个网盘下载链接,仅针对linux

http://pan.baidu.com/s/1pJLYK0z

 

下载之后,解压,看下INSTALL文档,直接make install即可

tar zxvf cloc-1.62.tar
cd cloc-1.62
sudo make install
lihuideMacBook-Pro:cloc-1.62 lihui$ which cloc
/usr/bin/cloc

可见已经安装到系统目录

 

下面就可以开始统计了,原版YouCompleteMe插件,不包括在线下载的

lihuideMacBook-Pro:Downloads lihui$ cloc YouCompleteMe-master/
      55 text files.
      54 unique files.
      18 files ignored.

http://cloc.sourceforge.net v 1.62  T=0.35 s (111.1 files/s, 18749.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                          32           1045           1096           3205
vim script                       2            226            157            652
DOS Batch                        1             16              1             95
Bourne Shell                     3             18              1             61
YAML                             1              0              0              9
-------------------------------------------------------------------------------
SUM:                            39           1305           1255           4022
-------------------------------------------------------------------------------

貌似还不够壮观,那么看看安装之后的文件夹

lihuideMacBook-Pro:Downloads lihui$ cloc YouCompleteMe/
    6715 text files.
    6227 unique files.
     643 files ignored.

http://cloc.sourceforge.net v 1.62  T=42.60 s (135.2 files/s, 31886.4 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
C/C++ Header                   2998          84309          89993         474894
C#                             1898          56211          63494         341189
Python                          461          16747          20125          59018
C++                             248          11630          13694          52611
XML                               6           2838              4          51008
MSBuild script                   39              0             88           6201
Go                               23            757            556           5225
make                              9            190            107            903
CMake                             8            253            517            895
vim script                        4            235            161            727
JSON                              8             15              0            625
m4                                4             68             48            535
DOS Batch                         3             62              3            425
HTML                             10             32              0            382
SKILL                             5             66              0            313
Bourne Shell                     14             77             79            304
Lisp                              2             53             48            296
YAML                              7             13              1            119
Tcl/Tk                            1             17              0             61
CSS                               1             12              7             51
Ruby                              1             12              1             47
ASP.Net                           5              0              0             36
Perl                              1              2             15             20
C                                 1              2              0             13
Bourne Again Shell                1              0              0              9
Objective C                       1              4              0              7
Javascript                        1              2             14              7
--------------------------------------------------------------------------------
SUM:                           5760         173607         188955         995921
--------------------------------------------------------------------------------

文件数目,注释,有效代码尽收眼底

 

假如直接是tar包,也是可以的

lihuideMacBook-Pro:Downloads lihui$ tar zcvf YouCompleteMe-master.tar.gz YouCompleteMe-master/
lihuideMacBook-Pro:Downloads lihui$ cloc YouCompleteMe-master.tar.gz
      55 text files.
      54 unique files.
      18 files ignored.

http://cloc.sourceforge.net v 1.62  T=0.30 s (131.9 files/s, 22257.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                          32           1045           1096           3205
vim script                       2            226            157            652
DOS Batch                        1             16              1             95
Bourne Shell                     3             18              1             61
YAML                             1              0              0              9
-------------------------------------------------------------------------------
SUM:                            39           1305           1255           4022
-------------------------------------------------------------------------------

跟上面文件夹输出结果是一致的

 

发表评论