代码改变世界

centos 安装cloc 代码统计工具

2021-06-16 14:26  方斌  阅读(1255)  评论(0编辑  收藏  举报
# 下载
https://jaist.dl.sourceforge.net/project/cloc/cloc/v1.64/cloc-1.64.tar.gz
# 配置
## 解压
tar zxvf cloc-1.64.tar.gz
## 配置环境变量
vi /etc/profile
export PATH=$PATH:/usr/local/src/cloc-1.64
## 生效配置文件
source /etc/profile

效果如下
统计k8s代码

[root@k8s-study kubernetes]# cloc .
Digest::MD5 not installed; will skip file uniqueness checks.
   19901 text files.
   19831 unique files.                                          
    2632 files ignored.

http://cloc.sourceforge.net v 1.64  T=91.73 s (188.8 files/s, 64775.8 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
Go                            14990         478788         826813        3616860
JSON                            536              4              0         749841
YAML                           1129           1202           1397         157269
Bourne Shell                    336           6115          12090          30087
Assembly                        108           1992           2613          11261
Protocol Buffers                115           5302          17494          10530
make                             66            526           1199           1937
C/C++ Header                      1            399           4367            839
Bourne Again Shell               14             91             74            777
Lua                               1             30              4            475
sed                               6              4             32            448
Python                            7            119            157            412
PowerShell                        3             41             80            176
C                                 7             49             79            156
HTML                              4              0              0              4
--------------------------------------------------------------------------------
SUM:                          17323         494662         866399        4581072
--------------------------------------------------------------------------------
[root@k8s-study kubernetes]#