博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
查看代码
阅读量:6988 次
发布时间:2019-06-27

本文共 1025 字,大约阅读时间需要 3 分钟。

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

你可能感兴趣的文章
小白系列-免费广告路由器web认证设置(2)
查看>>
Top 16 Java 应用类 - 这些功能再也不用自己写了
查看>>
面试题之矩阵与转置矩阵相乘
查看>>
linux光盘、U盘的挂载与卸载
查看>>
linux sudo命令
查看>>
LeetCode-最长回文子串
查看>>
【HDOJ】3400 Line belt
查看>>
JVM Guide
查看>>
大数模版
查看>>
HDU4044 GeoDefense(树形dp+分组背包)
查看>>
Microsoft .Net Remoting系列专题之三:Remoting事件处理全接触
查看>>
JavaScript常用标签和方法总结
查看>>
GO语言的进阶之路-网络编程之socket
查看>>
作业—四则运算题目生成器
查看>>
第十四周翻译-《Pro SQL Server Internals, 2nd edition》
查看>>
jdbcUrl is required with driverClassName spring boot 2.0版本
查看>>
C# 关于JArray和JObject封装JSON对象
查看>>
【Visual C++】游戏开发笔记之十 基础动画显示(三) 透明动画的实现
查看>>
今目标反思
查看>>
SQL Server 备份的 8 种方法。
查看>>