This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3354|Reply: 2

cloc counts blank, comment, and physical lines of source code in programming languages

[Copy link]
Posted on 2/23/2023 8:36:42 PM | | | |
CLOC is a tool for counting lines of source code information that can count blank, comment, and physical lines of source code in many programming languages. Given two versions of the codebase, the cloc can calculate the difference between blank lines, comment lines, and source code lines. It is written entirely in Perl and does not depend on standard distributions of Perl v5.6 and above (code from some external modules is embedded in the cloc), making it very portable. As we all know, cloc runs on a wide variety of Linux, FreeBSD, NetBSD, OpenBSD, macOS, AIX, HP-UX, Solaris, IRIX, z/OS, and Windows. (To run the Perl source version of the cloc on Windows, you need ActiveState Perl 5.6.1 or later, Strawberry Perl, Windows Subsystem for Linux, Cygwin, MobaXTerm, or the mingw environment and terminal, such as those provided by Git for Windows.) Alternatively, the Windows binary of the cloc generated using PAR::P acker can be used to run on a Windows computer that has neither Perl nor Cygwin. )


GitHub address:The hyperlink login is visible.
Download Address:The hyperlink login is visible.

Install via the package manager

npm install -g cloc              #The hyperlink login is visible.
sudo apt install cloc            # Debian, Ubuntu
sudo yum install cloc            # Red Hat, Fedora
sudo dnf install cloc            # Fedora 22 or later
sudo pacman -S cloc              # Arch
sudo emerge -av dev-util/cloc    # GentooThe hyperlink login is visible.
sudo apk add cloc                # Alpine Linux
doas pkg_add cloc                # OpenBSD
sudo pkg install cloc            # FreeBSD
sudo port install cloc           # macOS with MacPorts
brew install cloc                # macOS with Homebrew
choco install cloc               # Windows with Chocolatey
scoop install cloc               # Windows with Scoop

You can add a cloc to an environment variable, refer to the tutorial below:

cmd to set the permanent environment variable command
https://www.itsvse.com/thread-9230-1-1.html

Count the amount of code in the current folder



Exclude the amount of code for a folder



Count the number of lines of code for each file in the directory


Parameter options

--diff <set1> <set2> - calculates the code difference between the source files of set1 and set2. The input can be a mix of files and directories.
--git - force inputs to be recognized as git targets if they are not recognized as file or directory names in the first place.
--ignore-whitespace - ignores horizontal spaces when comparing files with --diff.
--max-file-size=<MB> - if you want to skip files larger than a given amount of MB.
--exclude-dir=<dir1>,<dir2> - exclude a given comma-separated directory.
--exclude-ext=<ext1>,<ext2> - Exclude the given file extension.
--csv - Export the results to CSV file format.
--csv-delimiter=<C> - uses <C>characters as delimiters.
--out=<file> - Save the result to<file> .
--quiet - disables all informational messages and only shows the final report.
--sql=<file> - Writes the result as create and insert statements, which can be read by a database program such as SQLite.

(End)




Previous:PDF.JS Preview PDF files Chinese no issues are shown
Next:【OData】(1) Basic knowledge of OData
Posted on 2/23/2023 10:23:01 PM |
Learn to learn
Posted on 2/24/2023 10:33:08 AM |
sha ye bu shi
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com