代码统计-量

代码统计的


一、限制与约束

1、代码行:要统计的是不包括空行、包括注释、 不包括复用代码、第三方包、不包括编译后变化的代码

  

新增代码量  
修改删除代码量  
测试代码量  
复用代码量  
开源代码量  
总规模 4444


2、功能点


二、统计方法:

1、手动统计之命令

当前目录下包括子目录,h**和C**文件行数,不包括空行

 find . -name "*.[hc]*" |xargs cat|grep -v ^$|wc -l   


2、手动统计之git-

 代码行统计:git log --author="${git.username}" --after={2015-01-01} --before={2016-01-01} --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 + $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -
提交次数统计:git log --author="t${git.username}" --after={2015-01-01} --before={2016-01-01} --oneline | wc -l 

     缺点:删除工程之后重复提交会重复计算

你可能感兴趣的:(代码统计-量)