Cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. Cloc project is written entirely in Perl using only modules from the standard distribution of Perl v5.6 and higher (well, sort of) and so is quite portable.
Cloc is known to run on many flavors of Linux, AIX, Solaris, IRIX64, z/OS, and Windows. (To run the Perl source version of cloc on Windows one needs ActiveState Perl 5.6.1 or higher, or Cygwin installed.
Here are some key features of "Cloc":
· Exists as a single, self-contained file that requires minimal installation effort---just download the file and run it.
· Can read language comment definitions from a file and thus potentially work with computer languages that do not yet exist.
· Allows results from multiple runs to be summed together by language and by project.
· Can count code within compressed archives (tar balls, Zip files, Java .ear files).
· Has numerous troubleshooting options.
· Handles file and directory names with spaces and other unusual characters.
· Has no dependencies outside the standard Perl distribution.
· Runs on Linux, FreeBSD, NetBSD, AIX, HP-UX, Solaris, IRIX64, and z/OS systems that have Perl 5.6 or higher. Runs on Windows with or without Perl.
Requirements:
· Perl
What's New in This Release:
· This release adds a new option, --unicode, for counting lines in files encoded with UTF-8.
· Also, the --progress-rate option now accepts a value of zero to suppress progress rate output.
Product's homepage
What's New in This Release: [ read full changelog ]
· Release Notes for cloc version 1.54 http://cloc.sourceforge.net October 1, 2011
New Languages:
· CMake
· Cython
· Objective C++
· Ocaml
· Smarty
New options and features:
· --autoconf
· Count files of recognized languages that end with ".in" (for example, code.h.in, Makefile.in) as used by GNU automake/autoconf.
· --match-d, --not-match-d
· Include, or skip over, directories whose names match provided regular expressions.
· --follow-links
· Follow symbolic links (on Unix-like OS's).
· YAML and XML output: header lines now include the cloc URL,
· version, # lines and files counted, etc.
· YAML and XML output: if writing to a file (rather than STDOUT),
· save the file name as an element inside the file.
· Include support for languages with double extensions. First
· implementation of these uses .spc.sql for SQL Stored Procedures
· and .data.sql as SQL Data as distinct from just SQL.
· Handle archive files (tar files, zip files, etc) with spaces
· in their names.
Bug Fixes:
· Lisp: Include .lisp as a valid file extension.
· Correctly identify operating system as Windows if MKS Toolkit is
· installed.
· Fix incorrectly handled .inc files (could be PHP or Pascal).
· --counted
· Correct output to show only files which were actually used to produce the code count. Also show the output by language rather than by filename.
· --diff
· Fixed null output when one input has a single file while the comparison input has multiple files.
· Fixed null output when no lines of code are modified in common files (only entire files were added or removed).
· Handle cases where one of the two inputs is an empty file or directory.
· --diff + --exclude-file-list
· --diff now skips files defined by --exclude-file-list
· --diff + --exclude-lang
· --diff now skips languages defined by --exclude-lang
· --diff + --xml
· Include user-provided xsl file name in XML --diff output.
· XML output for --by-file and --by-file-by-lang.
· --diff + --csv
· Added comma separated value output for --diff.
· --diff + --sum-reports
· Can now use the --sum-reports option with --diff.
· --exclude-dir
· Quote metacharacters when comparing directory names against
· --exclude-dir value.
· --strip-comments
· Do not remove blank lines if they follow lines with (language-dependent) continuation markers.
· --sum-reports + --list-file
· Allow the --sum-reports option to take its inputs from files defined by --list-file
Outstanding issues:
· --sql output formats remain unimplemented for --diff.