代码统计
来源:互联网 发布:淘宝没法付款怎么办 编辑:程序博客网 时间:2024/05/22 10:23
http://exp99.diandian.com/post/2012-06-02/40028807537
使用工具 cloc
cloc (Count Lines Of Code) counts, and computes differences of, comment lines, blank lines, and physical lines of source code in many programming languages.
cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. Given two versions of a code base, cloc can compute differences in blank, comment, and source lines. It is written entirely in Perl with no dependencies outside the standard distribution of Perl v5.6 and higher (code from some external modules is embedded within cloc) and so is quite portable. cloc is known to run on many flavors of Linux, Mac OS X, AIX, Solaris, IRIX, z/OS, and Windows.
使用方法:
http://garfileo.is-programmer.com/2010/6/11/lines-counting-using-cloc.18828.html
使用 cloc 统计代码行数
可能大家都知道用 `wc -l` 命令进行代码行数统计,但是它会将代码中的注释、空行所占用的文本行都统计在内。如果想查看一个 tar 包或一个项目目录中“实际”的代码行数并且不愿意自己去写一个脚本来做此类工作,那么可以考虑使用 cloc。
cloc 是一个 perl 脚本,它可以统计很多种编程语言的代码文件中的空行、注释以及实际的代 码行数。
示例 1:统计一个 tar 包中的代码行
$ > cloc small-2.0.tar.gz 42 text files. 41 unique files. 4 files ignored.http://cloc.sourceforge.net v 1.50 T=1.0 s (38.0 files/s, 3451.0 lines/s)-------------------------------------------------------------------------------Language files blank comment code-------------------------------------------------------------------------------C 21 435 482 1695C/C++ Header 8 102 161 275m4 4 18 4 136make 4 18 72 29Bourne Shell 1 2 20 2-------------------------------------------------------------------------------SUM: 38 575 739 2137-------------------------------------------------------------------------------
示例 2:统计项目目录中的代码行数
$> cd m2boxtree$> cloc ./ 68 text files. 65 unique files. 23 files ignored.http://cloc.sourceforge.net v 1.50 T=0.5 s (88.0 files/s, 9258.0 lines/s)-------------------------------------------------------------------------------Language files blank comment code-------------------------------------------------------------------------------C 17 611 94 2490C/C++ Header 14 230 301 381Bourne Shell 10 56 155 252make 2 3 0 25Python 1 4 4 23-------------------------------------------------------------------------------SUM: 44 904 554 3171-------------------------------------------------------------------------------
先安装brew
http://blog.csdn.net/jijunyuan/article/details/39672291
安装命令如下:
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
当brew安装成功后,就可以随意安装自己想要的软件了,例如cloc,命令如下:
sudo brew install cloc
卸载的话,命令如下:
sudo brew uninstall cloc
查看安装软件的话,命令如下:
sudo brew search /apache*/ /apache*/是使用的正则表达式,用/分割。- 代码统计
- 代码统计
- 代码统计
- 代码统计
- 统计代码行数代码
- 网站流量统计代码
- 代码行数统计类
- 网站流量统计代码
- 网站流量统计代码
- 代码行数统计器
- 统计代码行数源码
- 登陆用户统计代码!
- 统计代码行数
- 统计代码行数源码
- 网站流量统计代码
- 代码行数统计工具
- 网站流量统计代码
- 代码行数统计器
- 【Cocos2d-x Lua笔记一】环境搭建
- 从相册简单选着图片
- 第18条:要让接口易于正确使用,而不易被误用
- 转换日期格式
- 电源滤波电容10UF 和0.1UF
- 代码统计
- Android入门笔记 - 多媒体 - MediaPlayer
- 做人拿得起,做事放得下
- C程序函数注释格式
- ARM MISP区别
- 简单邮件系统程序
- 聊聊高并发(三十三)Java内存模型那些事(一)从一致性(Consistency)的角度理解Java内存模型
- hive 学习(1) 内置函数以及数据类型
- 获取当前显示的fragment对象