跳到主要内容

统计项目代码行数

cloc

官方

https://github.com/AlDanial/cloc

cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.

npm install -g cloc              # https://www.npmjs.com/package/cloc
sudo apt install cloc # Debian, Ubuntu
sudo yum install cloc # Red Hat, Fedora
brew install cloc # macOS with Homebrew

安装

npm install -g cloc

使用:

cloc .

case

 cloc .   
943 text files.
883 unique files.
1065 files ignored.

github.com/AlDanial/cloc v 1.96 T=0.67 s (1321.5 files/s, 129703.7 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Java 832 11333 19196 52259
Maven 12 125 244 1971
SQL 1 62 37 385
Properties 17 48 46 285
XML 6 19 42 172
Bourne Shell 9 41 12 133
Python 1 17 1 123
Markdown 2 29 0 39
Dockerfile 1 14 8 16
JSON 2 0 0 7
-------------------------------------------------------------------------------
SUM: 883 11688 19586 55390
-------------------------------------------------------------------------------