代码统计工具:cloc(count lines of code)能够兼容windows和linux操作系统
下载url:http://sourceforge.net/projects/cloc/files/cloc/
下面以windows系统为例说明配置过程:
- 下载cloc,并为cloc配置环境变量,使在windows命令行下所有目录可以执行cloc命令。我下载后cloc名称为cloc-1.62.exe,并且配置好了环境变量。
- 执行cloc-1.62可以查看到命令参数信息。
Input Options --extract-with=<cmd> This option is only needed if cloc is unable to figure out how to extract the contents of the input file(s) by itself. Use <cmd> to extract binary archive files (e.g.: .tar.gz, .zip, .Z). Use the literal '>FILE<' as a stand-in for the actual file(s) to be extracted. For example, to count lines of code in the input files gcc-4.2.tar.gz perl-5.8.8.tar.gz on Unix use --extract-with='gzip -dc >FILE< | tar xf -' or, if you have GNU tar, --extract-with='tar zxf >FILE<' and on Windows use, for example: --extract-with="\"c:\Program Files\WinZip\WinZip .exe\" -e -o >FILE< ." (if WinZip is installed there). --list-file=<file> Take the list of file and/or directory names to process from <file> which has one file/directory name per line. See also --exclude-list-file. --unicode Check binary files to see if they contain Unicode expanded ASCII text. This causes performance to drop noticably. Processing Options --autoconf Count .in files (as processed by GNU autoconf) of recognized languages. --by-file Report results for every source file encountered. --by-file-by-lang Report results for every source file encountered in addition to reporting by language. --diff <set1> <set2> Compute differences in code and comments between source file(s) of <set1> and <set2>. The inputs may be pairs of files, directories, or archives. Use --diff-alignment to generate a list showing which file pairs where compared. See also --ignore-case, --ignore-whitespace. --diff-timeout <N> Ignore files which take more than <N> seconds to process. Default is 10 seconds. (Large files with many repeated lines can cause Algorithm::Diff::sdiff() to take hours.) --follow-links [Unix only] Follow symbolic links to directories (sym links to files are always followed). --force-lang=<lang>[,<ext>] Process all files that have a <ext> extension with the counter for language <lang>. For example, to count all .f files with the Fortran 90 counter (which expects files to end with .f90) instead of the default Fortran 77 counter, use --force-lang="Fortran 90",f If <ext> is omitted, every file will be counted with the <lang> counter. This option can be specified multiple times (but that is only useful when <ext> is given each time). See also --script-lang, --lang-no-ext. --force-lang-def=<file> Load language processing filters from <file>, then use these filters instead of the built-in filters. Note: languages which map to the same file extension (for example: MATLAB/Objective C/MUMPS; Pascal/PHP; Lisp/OpenCL) will be ignored as these require additional processing that is not expressed in language definition files. Use --read-lang-def to define new language filters without replacing built-in filters (see also --write-lang-def). --ignore-whitespace Ignore horizontal white space when comparing files with --diff. See also --ignore-case. --ignore-case Ignore changes in case; consider upper- and lower- case letters equivalent when comparing files with --diff. See also --ignore-whitespace. --lang-no-ext=<lang> Count files without extensions using the <lang> counter. This option overrides internal logic for files without extensions (where such files are checked against known scripting languages by examining the first line for #!). See also --force-lang, --script-lang. --max-file-size=<MB> Skip files larger than <MB> megabytes when traversing directories. By default, <MB>=100. cloc's memory requirement is roughly twenty times larger than the largest file so running with files larger than 100 MB on a computer with less than 2 GB of memory will cause problems. Note: this check does not apply to files explicitly passed as command line arguments. --read-binary-files Process binary files in addition to text files. This is usually a bad idea and should only be attempted with text files that have embedded binary data. --read-lang-def=<file> Load new language processing filters from <file> and merge them with those already known to cloc. If <file> defines a language cloc already knows about, cloc's definition will take precedence. Use --force-lang-def to over-ride cloc's definitions (see also --write-lang-def ). --script-lang=<lang>,<s> Process all files that invoke <s> as a #! scripting language with the counter for language <lang>. For example, files that begin with #!/usr/local/bin/perl5.8.8 will be counted with the Perl counter by using --script-lang=Perl,perl5.8.8 The language name is case insensitive but the name of the script language executable, <s>, must have the right case. This option can be specified multiple times. See also --force-lang, --lang-no-ext. --sdir=<dir> Use <dir> as the scratch directory instead of letting File::Temp chose the location. Files written to this location are not removed at the end of the run (as they are with File::Temp). --skip-uniqueness Skip the file uniqueness check. This will give a performance boost at the expense of counting files with identical contents multiple times (if such duplicates exist). --stdin-name=<file> Give a file name to use to determine the language for standard input. --strip-comments=<ext> For each file processed, write to the current directory a version of the file which has blank lines and comments removed. The name of each
按照代码类型统计文件夹:E:\MY-SVN\projects\system下的代码并生成统计表报告。命令:cloc-1.62 --by-file-by-lang --xml --out=cloc.xml "E:\MY-SVN\projects\system" - 为方便生成统计报告,写了一个批处理脚本。在项目根目录下新建一个bin文件夹,并将脚本cloc.bat放入,执行脚本后会在bin目录下生成一个文件名称为code_reports.xml的代码统计报告。报告部分内容如下:
<languages> <language name="Java" files_count="52" blank="336" comment="256" code="1093" /> <language name="JSP" files_count="6" blank="17" comment="23" code="367" /> <language name="XML" files_count="4" blank="7" comment="22" code="181" /> <language name="Maven" files_count="1" blank="9" comment="6" code="63" /> <language name="Javascript" files_count="4" blank="0" comment="4" code="51" /> <language name="DOS Batch" files_count="2" blank="1" comment="0" code="20" /> <language name="JSON" files_count="1" blank="0" comment="0" code="20" /> <language name="Visualforce Component" files_count="1" blank="0" comment="0" code="19" /> <language name="HTML" files_count="1" blank="0" comment="0" code="8" /> <total sum_files="72" blank="370" comment="311" code="1822" /> </languages>
- cloc.bat脚本见附件。
相关推荐
代码统计工具是软件开发过程中非常重要的辅助工具,它们主要用于分析和评估项目代码的质量、规模以及结构。本篇文章将深入探讨“ozG4 プログラムアナライザー”这款日语代码统计工具,以及它在代码统计领域的应用。 ...
本文将详细介绍一个专为C#项目设计的代码统计工具,该工具简化了代码行数的计算过程。 标题中的“C#代码统计工具”是一个专门用于分析C#项目代码量的应用程序。它允许用户通过指定C#项目的根目录,快速获取项目中的...
《代码统计工具diffcount详解及应用》 在软件开发过程中,对代码的管理与分析是一项至关重要的任务。其中,代码统计工具是开发者用来衡量代码规模、跟踪代码变化、评估项目复杂性的重要辅助手段。本文将深入探讨一...
在这个场景中,我们关注的是一个名为"java代码统计工具"的应用,它专门用于统计.java文件中的代码行数和注释行数。这个工具包含了三个关键文件:`java代码统计工具.exe`是可执行程序,用户可以直接运行来执行统计;`...
代码统计工具CCT,全称为Count_Code Tool CCTsetup,是一款专为软件开发人员设计的实用工具,用于量化分析项目中的代码量。它可以帮助开发者、项目经理和团队更好地理解项目的规模,评估工作进度,以及进行代码质量...
本篇将详细探讨如何使用代码统计工具来处理Java项目,以及相关的技术要点。 首先,我们需要明确的是代码统计的目标。在Java环境下,有效的代码行数通常指的是不包括空行、注释行、导入语句等的可执行代码行。这些...
标题中的“源代码统计工具挺好用的 喜欢的朋友们就试试”表明这是一个用于统计源代码相关数据的工具,可能包括代码行数、注释行数等。描述进一步揭示了该工具的功能,它能够分析VC(Visual C++)项目,提供关于代码...
"Linecount代码统计工具"是一款高效实用的软件,专门用于统计各类编程语言的代码行数。这个工具在软件开发和项目管理中具有重要的作用,因为它能够帮助开发者和团队有效地了解项目的规模,跟踪代码的增长,以及在...
代码统计工具是软件开发过程中非常重要的辅助工具,它们主要用于分析和量化项目的代码量,帮助开发者了解项目的规模、复杂性以及不同编程语言的使用情况。在软件工程中,准确的代码统计能够为项目管理、质量控制、...
"Mac 代码统计工具"就是为此目的设计的应用,它可以有效地帮助用户统计.c、.cpp、.h和.m等常见编程语言的源代码行数。以下是对这个工具及其功能的详细解释。 首先,`CodeCount.app` 是这个工具的可执行文件,它是专...
**Qt C/C++代码统计工具** Qt是一个跨平台的应用程序开发框架,主要使用C++语言编写,它提供了丰富的GUI库和非GUI库,使得开发者能够创建功能强大的桌面、移动及嵌入式应用。本项目是一个基于Qt的C/C++代码统计工具...
《代码统计工具LineCount3.6.3:深入解析与应用》 在软件开发过程中,代码统计是一项重要的工作,它可以帮助我们了解项目的规模、评估开发进度以及衡量开发人员的工作量。今天我们将聚焦于一个名为“LineCount3.6.3...
SourceCount是一款强大的代码统计工具,它可以帮助开发者快速准确地统计项目中的代码行数,这对于项目管理和团队协作具有极高的价值。 SourceCount的主要功能在于其能够分析各种编程语言的源代码文件,包括但不限于...
源代码统计工具是一种用于分析和量化软件项目中源代码量的实用程序。这些工具能够提供有关项目规模、复杂性以及不同编程语言使用情况的关键信息。在软件开发过程中,源代码统计是评估工作量、衡量生产力、规划项目...
源代码统计工具 欢迎大家使用代码统计工具,在前几个月中,我用VB.net开发了一个代码统计工具,应为VB.net需要Framework支持,所以我将软件的开发环境改为Microsoft Visual C++ 6.0。本人对C++不怎么了解,这是用...
源代码统计工具是软件开发过程中不可或缺的辅助工具,它们能够帮助开发者分析项目规模,了解代码结构,以及评估项目的工作量。在本篇文章中,我们将深入探讨"SourceCounter"这款源代码统计工具的使用方法和下载步骤...
总的来说,SrcCount作为一款代码统计工具,其主要作用在于提供对HTML和JavaScript项目的关键统计信息,帮助开发者更好地理解和管理他们的代码库。通过深入分析和持续跟踪,SrcCount能够为团队带来更高效、更高质量的...
源代码统计工具。 简单的源代码统计工具,包括总行数,注释行数等
这就是“软件项目代码统计工具”发挥重要作用的地方。这款工具专为Windows平台设计,无需安装,提供简单易用的界面,使得代码统计工作变得快速而高效。 代码统计工具的核心功能是量化项目的源代码,这包括但不限于...