xcode 统计项目中代码的行数
###方法一: 终端命令进入项目目录下,命令如下
1
find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs wc -l
列出每个文件的行数
1
find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs grep -v "^$"|wc -l
列出代码行数总和
1
grep -v "^$"是去掉空行
注释也统计在代码量之内
###方法二:
使用CLOC,项目说明地址:http://cloc.sourceforge.net/
1.64 Perl脚本下载地址,https://github.com/douxinchun/CLOC
使用方法:
perl cloc-1.64.pl ./YourProjectName
result:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
200 files
744 text files.
630 unique files.
315 files ignored.
http://cloc.sourceforge.net v 1.64 T=2.56 s (199.8 files/s, 22014.2 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Objective C 242 6916 4208 28460
C/C++ Header 265 3605 8066 4870
JSON 3 0 0 107
Bourne Shell 1 5 0 65
-------------------------------------------------------------------------------
SUM: 511 10526 12274 33502
-------------------------------------------------------------------------------
This post is licensed under
CC BY 4.0
by the author.
Comments powered by Disqus.