查看代码
1、打開終端,cd 進入項目根目錄
2、輸入命令
a、總行數(包含空行和注釋)
find?.?-name?"*.h"? ?-or?-name?"*.m"?? -or?-name?"*.xib" ? -or?-name?"*.c" ??-or -name "*.mm" ? -or -name "*.cpp" ??-or -name "*.rss"? ?|xargs?wc?-l??
b、總行數(包含注釋,不包括空行)
? find?.?-name?"*.h"? ?-or?-name?"*.m"?? -or?-name?"*.xib" ? -or?-name?"*.c" ??-or -name "*.mm" ? -or -name "*.cpp" ??-or -name "*.rss"?|xargs?grep?-v?"^$"|wc?-l ?
- grep -v "^$"是去掉空行
- 注釋也統計在代碼量之內,畢竟也一個字一個字碼出來的
?
?
另一種方法:
使用由內森 基辛格分享的Perl腳本,這里下載
?
perl cloc-1.60.pl ./YourProjectName
?
result:
?
http://cloc.sourceforge.net v 1.60 ?T=1.23 s (149.2 files/s, 14369.5 lines/s)
-------------------------------------------------------------------------------
Language ? ? ? ? ? ? ? ? ? ? files ? ? ? ? ?blank ? ? ? ?comment ? ? ? ? ? code
-------------------------------------------------------------------------------
Objective C ? ? ? ? ? ? ? ? ? 87 ? ? ? ? ? 2879 ? ? ? ? ? 3193 ? ? ? ? ? ? ?8987
C/C++ Header ? ? ? ? ? ? ?96 ? ? ? ? ? ?621 ? ? ? ? ? ? 792 ? ? ? ? ? ? ? 1148
-------------------------------------------------------------------------------
SUM: ? ? ? ? ? ? ? ? ? ? ? ? ? 183 ? ? ? ? ?3500 ? ? ? ? ? 3985 ? ? ? ? ? ? 10135
-------------------------------------------------------------------------------
?
轉載于:https://www.cnblogs.com/softlit/p/5129636.html
總結
- 上一篇: 关键路径问题--完美版
- 下一篇: JDK_下载网址