前言
本文主要mark一下可以用来统计一个项目的所有代码行数的工具:SLOCCount
SLOCCount
主页:
https://dwheeler.com/sloccount/
安装注意:
- SLOCCount runs on GNU/Linux, FreeBSD, Apple Mac OS X, Windows, and hopefully on other systems too. 适用于各种OS
- To run on Windows, you have to install Cygwin first to create a Unix-like environment for SLOCCount (Cygwin users: be sure to use
Unix'' newlines, not
DOS’’ newlines, when you install Cygwin). 如果要在windows上运行,则需要安装:Cygwin
如何运行:
SLOCCount has a number of ease-of-use features. You can easily install it, particularly on RPM-based GNU/Linux systems. For most situations, once it’s installed all you need to do is type this to measure all the code in a given directory (including its descendants):
sloccount directoryname
如上,非常之方便,只需要一行代码,确实很顶。
适用的程序语言:
2019年12月2日11:02:16
目前有27中,包括:java,python,C,C++等等程序语言。
下载:
https://dwheeler.com/sloccount/sloccount-2.26.tar.gz
下载后根据readme安装就行。
其他类似的工具
- SLOC Compare mindx.josefspillner.de/kde/stats takes several sloccount output files (or several results stored in one file) and visualizes the output, so you see changes over time. The author, Josef Spillner, has used it to analyze KDE.
- FLOSSmole (formerly OSSmole) is a set of tools for gathering data (metrics) about the development of free/libre/open source projects. “We also publish the resulting analyses about FLOSS projects, and accept data donations from other research groups!”
- CLOC counts SLOC, and includes some code from SLOCCount.
- bcscr counts and compares lines of code in two directories and reports lines changed, lines added, and lines deleted.
以上摘自其官网
小结
实际上还有eclipse内可以简单计算代码行数等方法,不过无法排除注释(但基本也够用了估计)。
简单mark一下。