項目代碼統計
阿新 • • 發佈:2017-10-07
實現 自動 -name 局限 epo 選項 src 工程 pre
項目代碼統計:
工具一:SourceInsight
工程建立完畢後,選擇菜單Project->Project Report ,再選擇需要的選項導出報表,點ok。
比如,我選擇每個文件的大小以及行數。
結果如下:
使用source insight工具統計代碼的確比較方便,一鍵即可完成,但有一定的局限性,比如不能對文件按照類型進行統計。
工具二:Linux命令行
#查看代碼文件列表
find . -name ‘*.c‘ -o -name ‘*.h‘ -o -name ‘*.html‘ -o -name ‘*.htm‘ -o-name ‘*.txt‘ -o -name ‘Makefile‘ -o -name ‘*.pl‘ > ~/code.file #統計代碼文件數 find . -name ‘*.c‘ -o -name ‘*.h‘ -o -name ‘*.html‘ -o -name ‘*.htm‘ -o -name ‘*.txt‘ -o -name ‘Makefile‘ -o -name ‘*.pl‘ | wc -l >> ~/code.file
#統計代碼總行數
find . -regex ".*\(\.h\|\.c\|\.htm\|\.html\|\.pl\|\.txt\|Makefile\)$" | xargs wc -l
使用linux命令的好處是搜索速度很快,而且後續還可以將命令整理後,輸出一個腳本,實現自動化統計。
項目代碼統計