{"id":13394713,"url":"https://github.com/AlDanial/cloc","last_synced_at":"2025-03-13T20:31:41.949Z","repository":{"id":37390822,"uuid":"42029482","full_name":"AlDanial/cloc","owner":"AlDanial","description":"cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.","archived":false,"fork":false,"pushed_at":"2024-10-24T03:30:06.000Z","size":5146,"stargazers_count":19550,"open_issues_count":25,"forks_count":1021,"subscribers_count":214,"default_branch":"master","last_synced_at":"2024-10-30T01:39:23.627Z","etag":null,"topics":["cloc","count-lines","programming-language"],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlDanial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["AlDanial"]}},"created_at":"2015-09-07T03:30:43.000Z","updated_at":"2024-10-29T23:04:11.000Z","dependencies_parsed_at":"2023-10-01T18:06:58.626Z","dependency_job_id":"45b4157f-ecdc-4dd7-aaa9-46275639b389","html_url":"https://github.com/AlDanial/cloc","commit_stats":{"total_commits":934,"total_committers":124,"mean_commits":7.532258064516129,"dds":"0.24411134903640253","last_synced_commit":"64005f39906357bc896a4ceef8cdea293e23ad82"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlDanial%2Fcloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlDanial%2Fcloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlDanial%2Fcloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlDanial%2Fcloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlDanial","download_url":"https://codeload.github.com/AlDanial/cloc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242945835,"owners_count":20210763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloc","count-lines","programming-language"],"created_at":"2024-07-30T17:01:29.102Z","updated_at":"2025-03-13T20:31:41.934Z","avatar_url":"https://github.com/AlDanial.png","language":"Perl","readme":"\u003ca name=\"___top\"\u003e\u003c/a\u003e\n# cloc\n*Count Lines of Code*\n\n* * *\ncloc counts blank lines, comment lines, and physical lines of source code in many programming languages.\n\nLatest release:  v2.04 (Jan. 31, 2025)\n\n[![Version](https://img.shields.io/badge/version-2.04-blue.svg)](https://github.com/AlDanial/cloc)\n[![Contributors](https://img.shields.io/github/contributors/AlDanial/cloc.svg)](https://github.com/AlDanial/cloc/graphs/contributors)\n[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.42029482.svg)](https://doi.org/10.5281/zenodo.42029482)\n[![Forks](https://img.shields.io/github/forks/AlDanial/cloc.svg)](https://github.com/AlDanial/cloc/network/members)\n[![Downloads](https://img.shields.io/github/downloads/AlDanial/cloc/total.svg)]()\n\ncloc moved to GitHub in September 2015 after being hosted\nat http://cloc.sourceforge.net/ since August 2006.\n\n*   [Quick Start](#quick-start-)\n*   [Overview](#overview-)\n*   [Download](https://github.com/AlDanial/cloc/releases/latest)\n    *   [Install via package manager](#install-via-package-manager)\n    *   [Stable release](#stable-release)\n    *   [Development version](#development-version)\n*   [License](#license-)\n*   [Why Use cloc?](#why-use-cloc-)\n*   [Other Counters](#other-counters-)\n*   [Building a Windows Executable](#building-a-windows-executable-)\n*   [Basic Use](#basic-use-)\n*   [Options](#options-)\n*   [Recognized Languages](#recognized-languages-)\n*   [How it Works](#how-it-works-)\n*   [Advanced Use](#advanced-use-)\n    *   [Remove Comments from Source Code](#remove-comments-from-source-code-)\n    *   [Work with Compressed Archives](#work-with-compressed-archives-)\n    *   [Differences](#differences-)\n    *   [Create Custom Language Definitions](#create-custom-language-definitions-)\n    *   [Combine Reports](#combine-reports-)\n    *   [SQL](#sql-)\n    *   [Custom Column Output](#custom-column-output-)\n    *   [Wrapping cloc in other scripts](#wrapping-cloc-in-other-scripts-)\n    *   [git and UTF8 pathnames](#git-and-UTF8-pathnames-)\n    *   [Third Generation Language Scale Factors](#third-generation-language-scale-factors-)\n    *   [options.txt configuration file](#optionstxt-configuration-file-)\n    *   [Java Programmatic Interface](#java-programmatic-interface-)\n*   [Complex regular subexpression recursion limit ](#complex-regular-subexpression-recursion-limit-)\n*   [Limitations](#limitations-)\n*   [Requesting Support for Additional Languages](#requesting-support-for-additional-languages-)\n*   [Reporting Problems](#reporting-problems-)\n*   [Citation](#citation-)\n*   [Acknowledgments](#acknowledgments-)\n*   [Copyright](#copyright-)\n\n\u003ca name=\"Quick_Start\"\u003e\u003c/a\u003e      []({{{1)\n# [Quick Start \u0026#9650;](#___top \"click to go to top of document\")\n\nStep 1:  Download cloc (several methods, see below) or run cloc's\n[docker image](#run-via-docker).  The Windows executable has no requirements.\nThe source version of cloc requires a Perl interpreter, and the\nDocker version of cloc requires a Docker installation.\n\nStep 2:  Open a terminal (`cmd.exe` on Windows).\n\nStep 3:  Invoke cloc to count your source files, directories, archives,\nor git commits.\nThe executable name differs depending on whether you use the\ndevelopment source version (`cloc`), source for a\nreleased version (`cloc-2.04.pl`) or a Windows executable\n(`cloc-2.04.exe`).\n\nOn this page, `cloc` is the generic term\nused to refer to any of these.\n\n[Include Security](https://www.youtube.com/user/IncludeSecurity) has a\n[YouTube video](https://www.youtube.com/watch?v=eRLTkDMsCqs)\nshowing the steps in action.\n\n**a file**\n\u003cpre\u003e\nprompt\u003e cloc hello.c\n       1 text file.\n       1 unique file.\n       0 files ignored.\n\nhttps://github.com/AlDanial/cloc v 1.65  T=0.04 s (28.3 files/s, 340.0 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nC                                1              0              7              5\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\n**a directory**\n\u003cpre\u003e\nprompt\u003e cloc gcc-5.2.0/gcc/c\n      16 text files.\n      15 unique files.\n       3 files ignored.\n\nhttps://github.com/AlDanial/cloc v 1.65  T=0.23 s (57.1 files/s, 188914.0 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nC                               10           4680           6621          30812\nC/C++ Header                     3             99            286            496\n-------------------------------------------------------------------------------\nSUM:                            13           4779           6907          31308\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\n**an archive**\n\nWe'll pull cloc's source zip file from GitHub, then count the contents:\n\u003cpre\u003e\nprompt\u003e wget https://github.com/AlDanial/cloc/archive/master.zip\n\nprompt\u003e cloc master.zip\nhttps://github.com/AlDanial/cloc v 1.65  T=0.07 s (26.8 files/s, 141370.3 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nPerl                             2            725           1103           8713\n-------------------------------------------------------------------------------\nSUM:                             2            725           1103           8713\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\n**a git repository, using a specific commit**\n\nThis example uses code from\n\u003ca href=https://pypi.python.org/pypi/pudb\u003ePuDB\u003c/a\u003e, a fantastic Python debugger.\n\n\u003cpre\u003e\nprompt\u003e git clone https://github.com/inducer/pudb.git\n\nprompt\u003e cd pudb\n\nprompt\u003e cloc 6be804e07a5db\n      48 text files.\n      41 unique files.                              \n       8 files ignored.\n\ngithub.com/AlDanial/cloc v 1.99  T=0.04 s (1054.9 files/s, 189646.8 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nPython                          28           1519            728           4659\nreStructuredText                 6            102             20            203\nYAML                             2              9              2             75\nBourne Shell                     3              6              0             17\nText                             1              0              0             11\nmake                             1              4              6             10\n-------------------------------------------------------------------------------\nSUM:                            41           1640            756           4975\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\n**each subdirectory of a particular directory**\n\nSay you have a directory with three different git-managed projects,\nProject0, Project1, and Project2.  You can use your shell's looping\ncapability to count the code in each.  This example uses bash (scroll down for cmd.exe example):\n\u003cpre\u003e\nprompt\u003e for d in ./*/ ; do (cd \"$d\" \u0026\u0026 echo \"$d\" \u0026\u0026 cloc --vcs git); done\n./Project0/\n7 text files.\n       7 unique files.\n       1 file ignored.\n\ngithub.com/AlDanial/cloc v 1.71  T=0.02 s (390.2 files/s, 25687.6 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nD                                4             61             32            251\nMarkdown                         1              9              0             38\nmake                             1              0              0              4\n-------------------------------------------------------------------------------\nSUM:                             6             70             32            293\n-------------------------------------------------------------------------------\n./Project1/\n       7 text files.\n       7 unique files.\n       0 files ignored.\n\ngithub.com/AlDanial/cloc v 1.71  T=0.02 s (293.0 files/s, 52107.1 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nGo                               7            165            282            798\n-------------------------------------------------------------------------------\nSUM:                             7            165            282            798\n-------------------------------------------------------------------------------\n./Project2/\n      49 text files.\n      47 unique files.\n      13 files ignored.\n\ngithub.com/AlDanial/cloc v 1.71  T=0.10 s (399.5 files/s, 70409.4 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nPython                          33           1226           1026           3017\nC                                4            327            337            888\nMarkdown                         1             11              0             28\nYAML                             1              0              2             12\n-------------------------------------------------------------------------------\nSUM:                            39           1564           1365           3945\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\n**each subdirectory of a particular directory (Windows/cmd.exe)**\n\u003cpre\u003e\nfor /D %I in (.\\*) do cd %I \u0026\u0026 cloc --vcs git \u0026\u0026 cd ..\n\u003c/pre\u003e\n\n[](1}}})\n\u003ca name=\"Overview\"\u003e\u003c/a\u003e      []({{{1)\n# [Overview \u0026#9650;](#___top \"click to go to top of document\")\n\ncloc counts blank lines, comment lines, and physical lines of source\ncode in [many programming languages](#Languages). Given two versions of\na code base, cloc can compute differences in blank, comment, and source\nlines. It is written entirely in Perl with no dependencies outside the\nstandard distribution of Perl v5.6 and higher (code from some external\nmodules is [embedded within\ncloc](https://github.com/AlDanial/cloc#regexp_common)) and so is\nquite portable. cloc is known to run on many flavors of Linux, FreeBSD,\nNetBSD, OpenBSD, macOS, AIX, HP-UX, Solaris, IRIX, z/OS, and Windows.\n(To run the Perl source version of cloc on Windows one needs\n[ActiveState Perl](http://www.activestate.com/activeperl) 5.6.1 or\nhigher, [Strawberry Perl](http://strawberryperl.com/),\nWindows Subsystem for Linux,\n[Cygwin](http://www.cygwin.com/),\n[MobaXTerm](http://mobaxterm.mobatek.net/) with the Perl plug-in\ninstalled,\nor\na mingw environment and terminal such as provided by\n[Git for Windows](https://gitforwindows.org/).\nAlternatively one can use the Windows binary of cloc\ngenerated with [PAR::Packer](http://search.cpan.org/~rschupp/PAR-Packer-1.019/lib/pp.pm)\nto run on Windows computers that have neither Perl nor Cygwin.)\n\nIn addition to counting code in individual text files, directories,\nand git repositories, cloc can also count code in archive files such\nas ``.tar`` (including compressed versions), ``.zip``, Python\nwheel ``.whl``, Jupyter notebook ``.ipynb``, source RPMs ``.rpm``\nor ``.src`` (requires ``rpm2cpio``),\nand Debian ``.deb`` files (requires ``dpkg-deb``).\n\ncloc contains code from David Wheeler's\n[SLOCCount](http://www.dwheeler.com/sloccount/),\nDamian Conway and Abigail's Perl module\n[Regexp::Common](http://search.cpan.org/%7Eabigail/Regexp-Common-2.120/lib/Regexp/Common.pm),\nSean M. Burke's Perl module\n[Win32::Autoglob](http://search.cpan.org/%7Esburke/Win32-Autoglob-1.01/Autoglob.pm),\nand Tye McQueen's Perl module\n[Algorithm::Diff](http://search.cpan.org/%7Etyemq/Algorithm-Diff-1.1902/lib/Algorithm/Diff.pm).\nLanguage scale factors were derived from Mayes Consulting, LLC web site\nhttp://softwareestimator.com/IndustryData2.htm.\n\nNew releases nominally appear every six months.\n[](1}}})\n\n\u003ca name=\"Docker\"\u003e\u003c/a\u003e []({{{1)\n## Run via docker\n\nThese docker commands count lines of code in and below\nthe current directory:\n\n```shell\ndocker run --rm -v $PWD:/tmp aldanial/cloc .\n```\n\n### Run via docker on git-bash\n```shell\ndocker run --rm -v \"/$(pwd -W)\":/tmp aldanial/cloc .\n```\n\n## Install via package manager\nDepending your operating system, one of these installation methods may\nwork for you (all but the last two entries for Windows require\na Perl interpreter):\n\n    npm install -g cloc              # https://www.npmjs.com/package/cloc\n    sudo apt install cloc            # Debian, Ubuntu\n    sudo yum install cloc            # Red Hat, Fedora\n    sudo dnf install cloc            # Fedora 22 or later\n    sudo pacman -S cloc              # Arch\n    yay -S cloc-git                  # Arch AUR (latest git version)\n    sudo emerge -av dev-util/cloc    # Gentoo https://packages.gentoo.org/packages/dev-util/cloc\n    sudo apk add cloc                # Alpine Linux\n    doas pkg_add cloc                # OpenBSD\n    sudo pkg install cloc            # FreeBSD\n    sudo port install cloc           # macOS with MacPorts\n    brew install cloc                # macOS with Homebrew\n    winget install AlDanial.Cloc     # Windows with winget (might not work, ref https://github.com/AlDanial/cloc/issues/849)\n    choco install cloc               # Windows with Chocolatey\n    scoop install cloc               # Windows with Scoop\n\n**Note**: I don't control any of these packages.\nIf you encounter a bug in cloc using one of the above\npackages, try with cloc pulled from the latest stable release here\non GitHub (link follows below) before submitting a problem report.\n[](1}}})\n\u003ca name=\"Stable\"\u003e\u003c/a\u003e []({{{1)\n## Stable release\n\nDownload the latest released cloc source file, for example `cloc-2.04.pl`, or\nthe Windows executable `cloc-2.04.exe` from\nhttps://github.com/AlDanial/cloc/releases/latest\n\n\u003ca name=\"Dev\"\u003e\u003c/a\u003e\n## Development version\n\nDownload the cloc source code at https://github.com/AlDanial/cloc/raw/master/cloc and\nsave it as the file `cloc` (or `cloc.pl`, or whatever executable name you wish).\nThe next step depends on the operating system you're using.\n\n### On Unix-like systems, including macOS\n\nIn a terminal, go to the download directory\nand make the cloc file executable, then give it a test run.\nFor example\n\n```shell\n» cd ~/Downloads\n» chmod +x cloc\n» ./cloc --version\n```\n\nFor future use, move the file to a more convenient directory in your `PATH`\nsuch as `/usr/local/bin` or `~/bin`.\n\n### On Windows\n\nYou'll need a Perl interpreter such as [Strawberry Perl](http://strawberryperl.com/)\ninstalled to run the source version of cloc.\nAfter downloading the cloc source file, open a command prompt or PowerShell window,\nnavigate to the download directory (`C:\\TEMP` in the example below), then test cloc with:\n\n```dos\ncd C:\\TEMP\u003e\nC:TEMP\\\u003e perl cloc --version\n```\n\n[](1}}})\n\u003ca name=\"License\"\u003e\u003c/a\u003e []({{{1)\n# [License \u0026#9650;](#___top \"click to go to top of document\")\n\ncloc is licensed under the\n[GNU General Public License, v 2](http://www.gnu.org/licenses/gpl-2.0.html),\nexcluding portions which\nare copied from other sources. Code\ncopied from the Regexp::Common, Win32::Autoglob, and Algorithm::Diff\nPerl modules is subject to the\n[Artistic License](https://opensource.org/license/artistic-2-0).\n[](1}}})\n\u003ca name=\"why_use\"\u003e\u003c/a\u003e []({{{1)\n# [Why Use cloc? \u0026#9650;](#___top \"click to go to top of document\")\n\ncloc has many features that make it easy to use, thorough, extensible, and portable:\n\n1.  Exists as a single, self-contained file that requires minimal installation effort---just download the file and run it.\n2.  Can read language comment definitions from a file and thus potentially work with computer languages that do not yet exist.\n3.  Allows results from multiple runs to be summed together by language and by project.\n4.  Can produce results in a variety of formats: plain text, Markdown, SQL, JSON, XML, YAML, comma separated values.\n5.  Can count code within compressed archives (tar balls, Zip files, Java .ear files).\n6.  Has numerous troubleshooting options.\n7.  Handles file and directory names with spaces and other unusual characters.\n8.  Has no dependencies outside the standard Perl distribution.\n9.  Runs on Linux, FreeBSD, NetBSD, OpenBSD, macOS, AIX, HP-UX, Solaris, IRIX, and z/OS systems that have Perl 5.6 or higher. The source version runs on Windows with either ActiveState Perl, Strawberry Perl, Cygwin, or MobaXTerm+Perl plugin. Alternatively on Windows one can run the Windows binary which has no dependencies.\n[](1}}})\n\n\u003ca name=\"Other_Counters\"\u003e\u003c/a\u003e []({{{1)\n# [Other Counters \u0026#9650;](#___top \"click to go to top of document\")\n\nIf cloc does not suit your needs here are other freely available counters to consider:\n\n*   [loc](https://github.com/cgag/loc/)\n*   [gcloc](https://github.com/JoaoDanielRufino/gcloc)\n*   [gocloc](https://github.com/hhatto/gocloc/)\n*   [Ohcount](https://github.com/blackducksoftware/ohcount/)\n*   [scc](https://github.com/boyter/scc/)\n*   [sclc](https://code.google.com/archive/p/sclc/)\n*   [SLOCCount](http://www.dwheeler.com/sloccount/)\n*   [Sonar](http://www.sonarsource.org/)\n*   [tokei](https://github.com/Aaronepower/tokei/)\n*   [Unified Code Count](http://csse.usc.edu/ucc_new/wordpress/)\n\nOther references:\n\n*   QSM's [directory](http://www.qsm.com/CodeCounters.html) of code counting tools.\n*   The [Wikipedia entry](http://en.wikipedia.org/wiki/Source_lines_of_code) for source code line counts.\n[](1}}})\n\n# \u003ca name=\"regexp_common\"\u003eRegexp::Common, Digest::MD5, Win32::Autoglob, Algorithm::Diff\u003c/a\u003e []({{{1)\n\nAlthough cloc does not need Perl modules outside those found in the\nstandard distribution, cloc does rely on a few external modules. Code\nfrom three of these external modules--Regexp::Common, Win32::Autoglob,\nand Algorithm::Diff--is embedded within cloc. A fourth module,\nDigest::MD5, is used only if it is available. If cloc finds\nRegexp::Common or Algorithm::Diff installed locally it will use those\ninstallation. If it doesn't, cloc will install the parts of\nRegexp::Common and/or Algorithm:Diff it needs to temporary directories\nthat are created at the start of a cloc run then removed when the run is\ncomplete. The necessary code from Regexp::Common v2.120 and\nAlgorithm::Diff v1.1902 are embedded within the cloc source code (see\nsubroutines `Install_Regexp_Common()` and `Install_Algorithm_Diff()` ).\nOnly three lines are needed from Win32::Autoglob and these are included\ndirectly in cloc.\n\nAdditionally, cloc will use Digest::MD5 to validate uniqueness among\nequally-sized input files if Digest::MD5 is installed locally.\n\nA parallel processing option, \u003ctt\u003e--processes=\u003ci\u003eN\u003c/i\u003e\u003c/tt\u003e, was introduced with\ncloc version 1.76 to enable faster runs on multi-core machines.  However,\nto use it, one must have the module Parallel::ForkManager installed.\nThis module does not work reliably on Windows so parallel processing\nwill only work on Unix-like operating systems.\n\nThe Windows binary is built on a computer that has both Regexp::Common\nand Digest::MD5 installed locally.\n[](1}}})\n\u003ca name=\"building_exe\"\u003e\u003c/a\u003e []({{{1)\n# [Building a Windows Executable \u0026#9650;](#___top \"click to go to top of document\")\n\n#### Create your own executable\nThe most robust option for creating a Windows executable of\ncloc is to use [ActiveState's Perl Development Kit](http://www.activestate.com/perl-dev-kit).\nIt includes a utility, `perlapp`, which can build stand-alone\nWindows, Mac, and Linux binaries of Perl source code.\n\n[perl2exe](http://www.indigostar.com/perl2exe/)\nwill also do the trick.  If you do have `perl2exe`, modify lines\n84-87 in the cloc source code for a minor code\nmodification that is necessary to make a cloc Windows executable.\n\nOtherwise, to build a Windows executable with `pp` from\n`PAR::Packer`, first install a Windows-based Perl distribution\n(for example Strawberry Perl or ActivePerl) following their\ninstructions. Next, open a command prompt, aka a DOS window and install\nthe PAR::Packer module. Finally, invoke the newly installed `pp`\ncommand with the cloc source code to create an `.exe` file:\n\n\u003cpre\u003e\nC:\u003e cpan -i Digest::MD5\nC:\u003e cpan -i Regexp::Common\nC:\u003e cpan -i Algorithm::Diff\nC:\u003e cpan -i PAR::Packer\nC:\u003e cpan -i Win32::LongPath\nC:\u003e pp -M Win32::LongPath -M Encode::Unicode -M Digest::MD5 -c -x -o cloc-2.04.exe cloc-2.04.pl\n\u003c/pre\u003e\n\nA variation on the instructions above is if you installed the portable\nversion of Strawberry Perl, you will need to run `portableshell.bat` first\nto properly set up your environment.\n\nThe Windows executable in the Releases section, \u003ctt\u003ecloc-2.04.exe\u003c/tt\u003e,\nwas built on a 64 bit Windows 10 computer using\n[Strawberry Perl](http://strawberryperl.com/)\n5.30.2 and\n[PAR::Packer](http://search.cpan.org/~rschupp/PAR-Packer-1.050/lib/pp.pm)\nto build the `.exe`.\n\n#### Is the Windows executable safe to run?  Does it have malware?\n\nIdeally, no one would need the Windows executable because they\nhave a Perl interpreter installed on their machines and can\nrun the cloc source file.\nOn centrally-managed corporate Windows machines, however, this\nthis may be difficult or impossible.\n\nThe Windows executable distributed with cloc is provided as\na best-effort of a virus and malware-free `.exe`.\nYou are encouraged to run your own virus scanners against the\nexecutable and also check sites such\nhttps://www.virustotal.com/ .\nThe entries for recent versions are:\n\ncloc-2.04.exe:\nhttps://www.virustotal.com/gui/file/89cda0038bf4e13c6c13ebc1e60bec4dfad362e69ac8a5b8e2d5ebe3020359e1\n\ncloc-2.02-winget.exe:  (includes [PR 850](https://github.com/AlDanial/cloc/pull/850) to allow\n[running from a symlink on Windows](https://github.com/AlDanial/cloc/issues/849))\nhttps://www.virustotal.com/gui/file/be033061e091fea48a5bc9e8964cee0416ddd5b34bd5226a1c9aa4b30bdba66a?nocache=1\n\ncloc-2.02.exe:\nhttps://www.virustotal.com/gui/file/369ed76125f7399cd582d169adf39a2e08ae5066031fea0cc8b2836ea50e7ce2?nocache=1\n\ncloc-2.00.exe:\nhttps://www.virustotal.com/gui/file/7a234ef0cb495de1b5776acf88c5554e2bab1fb02725a5fb85756a6db3121c1f\n\ncloc-1.98.exe:\nhttps://www.virustotal.com/gui/file/88615d193ec8c06f7ceec3cc1d661088af997798d87ddff331d9e9f9128a6782?nocache=1\n\ncloc-1.96.1.exe:\nhttps://www.virustotal.com/gui/file/00b1c9dbbfb920dabd374418e1b86d2c24b8cd2b8705aeb956dee910d0d75d45?nocache=1\n\ncloc-1.96.exe:\nhttps://www.virustotal.com/gui/file/54bf5f46fbaba7949c4eb2d4837b03c774c0ba587448a5bad9b8efc0222b1583?nocache=1\n\ncloc-1.94.exe:\nhttps://www.virustotal.com/gui/file/b48a6002fb75fa66ec5d0c05a5c4d51f2ad22b5b025b7eb4e3945d18419c0952?nocache=1\n\ncloc-1.92.exe:\nhttps://www.virustotal.com/gui/file/2668fcf8609c431e8934fe9e1866bc620c58d198c4eb262f1d3ef31ef4a690f7\n\ncloc-1.90.exe:\nhttps://www.virustotal.com/gui/file/d655caae55486f9bac39f7e3c7b7553bcfcfe2b88914c79bfc328055f22b8a37/detection\n\ncloc-1.88.exe:\nhttps://www.virustotal.com/gui/file/97d5d2631d1cccdbfd99267ab8a4cf5968816bbe52c0f9324e72e768857f642d/detection\n\ncloc-1.86.exe:\nhttps://www.virustotal.com/gui/file/1b2e189df1834411b34534db446330d1c379b4bc008af3042ee9ade818c6a1c8/detection\n\ncloc-1.84.exe:\nhttps://www.virustotal.com/gui/file/e73d490c1e4ae2f50ee174005614029b4fa2610dcb76988714839d7be68479af/detection\n\ncloc-1.82.exe:\nhttps://www.virustotal.com/#/file/2e5fb443fdefd776d7b6b136a25e5ee2048991e735042897dbd0bf92efb16563/detection\n\ncloc-1.80.exe:\nhttps://www.virustotal.com/#/file/9e547b01c946aa818ffad43b9ebaf05d3da08ed6ca876ef2b6847be3bf1cf8be/detection\n\ncloc-1.78.exe:\nhttps://www.virustotal.com/#/file/256ade3df82fa92febf2553853ed1106d96c604794606e86efd00d55664dd44f/detection\n\ncloc-1.76.exe:\nhttps://www.virustotal.com/#/url/c1b9b9fe909f91429f95d41e9a9928ab7c58b21351b3acd4249def2a61acd39d/detection\n\ncloc-1.74_x86.exe:\nhttps://www.virustotal.com/#/file/b73dece71f6d3199d90d55db53a588e1393c8dbf84231a7e1be2ce3c5a0ec75b/detection\n\ncloc 1.72 exe:\nhttps://www.virustotal.com/en/url/8fd2af5cd972f648d7a2d7917bc202492012484c3a6f0b48c8fd60a8d395c98c/analysis/\n\ncloc 1.70 exe:\nhttps://www.virustotal.com/en/url/63edef209099a93aa0be1a220dc7c4c7ed045064d801e6d5daa84ee624fc0b4a/analysis/\n\ncloc 1.68 exe:\nhttps://www.virustotal.com/en/file/c484fc58615fc3b0d5569b9063ec1532980281c3155e4a19099b11ef1c24443b/analysis/\n\ncloc 1.66 exe:\nhttps://www.virustotal.com/en/file/54d6662e59b04be793dd10fa5e5edf7747cf0c0cc32f71eb67a3cf8e7a171d81/analysis/1453601367/\n\n#### Why is the Windows executable so large?\n\nWindows executables of cloc versions 1.60 and earlier, created with\nperl2exe as noted above, are about 1.6 MB, while versions 1.62 and 1.54, created\nwith `PAR::Packer`, are 11 MB.\nVersion 1.66, built with a newer version of `PAR::Packer`, is about 5.5 MB.\nWhy are the `PAR::Packer`, executables so\nmuch larger than those built with perl2exe? My theory is that perl2exe\nuses smarter tree pruning logic\nthan `PAR::Packer`, but that's pure speculation.\n\n[](1}}})\n\u003ca name=\"Basic_Use\"\u003e\u003c/a\u003e []({{{1)\n# [Basic Use \u0026#9650;](#___top \"click to go to top of document\")\n\ncloc is a command line program that takes file, directory, and/or\narchive names as inputs. Here's an example of running cloc against the\nPerl v5.22.0 source distribution:\n\n\u003cpre\u003e\nprompt\u003e cloc perl-5.22.0.tar.gz\n    5605 text files.\n    5386 unique files.\n    2176 files ignored.\n\nhttps://github.com/AlDanial/cloc v 1.65  T=25.49 s (134.7 files/s, 51980.3 lines/s)\n-----------------------------------------------------------------------------------\nLanguage                         files          blank        comment           code\n-----------------------------------------------------------------------------------\nPerl                              2892         136396         184362         536445\nC                                  130          24676          33684         155648\nC/C++ Header                       148           9766          16569         147858\nBourne Shell                       112           4044           6796          42668\nPascal                               8            458           1603           8592\nXML                                 33            142              0           2410\nYAML                                49             20             15           2078\nC++                                 10            313            277           2033\nmake                                 4            426            488           1986\nProlog                              12            438              2           1146\nJSON                                14              1              0           1037\nyacc                                 1             85             76            998\nWindows Message File                 1            102             11            489\nDOS Batch                           14             92             41            389\nWindows Resource File                3             10              0             85\nD                                    1              5              7              8\nLisp                                 2              0              3              4\n-----------------------------------------------------------------------------------\nSUM:                              3434         176974         243934         903874\n-----------------------------------------------------------------------------------\n\n\u003c/pre\u003e\n\nTo run cloc on Windows computers, open up a command (aka DOS) window\nand invoke cloc.exe from the command line there.\nAlternatively, try ClocViewer, the GUI wrapper around cloc found at\nhttps://github.com/Roemer/ClocViewer.\n\nSee also https://github.com/jmensch1/codeflower for a\ngraphical rendering of cloc results.\n[](1}}})\n\u003ca name=\"Options\"\u003e\u003c/a\u003e []({{{1)\n# [Options \u0026#9650;](#___top \"click to go to top of document\")\n\n\u003cpre\u003e\nprompt\u003e cloc --help\n\nUsage: cloc [options] \u0026lt;file(s)/dir(s)/git hash(es)\u0026gt; | \u0026lt;set 1\u0026gt; \u0026lt;set 2\u0026gt; | \u0026lt;report files\u0026gt;\n\n Count, or compute differences of, physical lines of source code in the\n given files (may be archives such as compressed tarballs or zip files,\n or git commit hashes or branch names) and/or recursively below the\n given directories.\n\n Input Options\n   --extract-with=\u0026lt;cmd\u0026gt;      This option is only needed if cloc is unable\n                             to figure out how to extract the contents of\n                             the input file(s) by itself.\n                             Use \u0026lt;cmd\u0026gt; to extract binary archive files (e.g.:\n                             .tar.gz, .zip, .Z).  Use the literal '\u0026gt;FILE\u0026lt;' as\n                             a stand-in for the actual file(s) to be\n                             extracted.  For example, to count lines of code\n                             in the input files\n                                gcc-4.2.tar.gz  perl-5.8.8.tar.gz\n                             on Unix use\n                               --extract-with='gzip -dc \u0026gt;FILE\u0026lt; | tar xf -'\n                             or, if you have GNU tar,\n                               --extract-with='tar zxf \u0026gt;FILE\u0026lt;'\n                             and on Windows use, for example:\n                               --extract-with=\"\\\"c:\\Program Files\\WinZip\\WinZip32.exe\\\" -e -o \u0026gt;FILE\u0026lt; .\"\n                             (if WinZip is installed there).\n   --list-file=\u0026lt;file\u0026gt;        Take the list of file and/or directory names to\n                             process from \u0026lt;file\u0026gt;, which has one file/directory\n                             name per line.  Only exact matches are counted;\n                             relative path names will be resolved starting from\n                             the directory where cloc is invoked.  Set \u0026lt;file\u0026gt;\n                             to - to read file names from a STDIN pipe.\n                             See also --exclude-list-file.\n   --diff-list-file=\u0026lt;file\u0026gt;   Take the pairs of file names to be diff'ed from\n                             \u0026lt;file\u0026gt;, whose format matches the output of\n                             --diff-alignment.  (Run with that option to\n                             see a sample.)  The language identifier at the\n                             end of each line is ignored.  This enables --diff\n                             mode and bypasses file pair alignment logic.\n   --vcs=\u0026lt;VCS\u0026gt;               Invoke a system call to \u0026lt;VCS\u0026gt; to obtain a list of\n                             files to work on.  If \u0026lt;VCS\u0026gt; is 'git', then will\n                             invoke 'git ls-files' to get a file list and\n                             'git submodule status' to get a list of submodules\n                             whose contents will be ignored.  See also --git\n                             which accepts git commit hashes and branch names.\n                             If \u0026lt;VCS\u0026gt; is 'svn' then will invoke 'svn list -R'.\n                             The primary benefit is that cloc will then skip\n                             files explicitly excluded by the versioning tool\n                             in question, ie, those in .gitignore or have the\n                             svn:ignore property.\n                             Alternatively \u0026lt;VCS\u0026gt; may be any system command\n                             that generates a list of files.\n                             Note:  cloc must be in a directory which can read\n                             the files as they are returned by \u0026lt;VCS\u0026gt;.  cloc will\n                             not download files from remote repositories.\n                             'svn list -R' may refer to a remote repository\n                             to obtain file names (and therefore may require\n                             authentication to the remote repository), but\n                             the files themselves must be local.\n                             Setting \u0026lt;VCS\u0026gt; to 'auto' selects between 'git'\n                             and 'svn' (or neither) depending on the presence\n                             of a .git or .svn subdirectory below the directory\n                             where cloc is invoked.\n   --unicode                 Check binary files to see if they contain Unicode\n                             expanded ASCII text.  This causes performance to\n                             drop noticeably.\n\n Processing Options\n   --autoconf                Count .in files (as processed by GNU autoconf) of\n                             recognized languages.  See also --no-autogen.\n   --by-file                 Report results for every source file encountered.\n   --by-file-by-lang         Report results for every source file encountered\n                             in addition to reporting by language.\n   --config \u0026lt;file\u0026gt;           Read command line switches from \u0026lt;file\u0026gt; instead of\n                             the default location of /home/al/.config/cloc/options.txt.\n                             The file should contain one switch, along with\n                             arguments (if any), per line.  Blank lines and lines\n                             beginning with '#' are skipped.  Options given on\n                             the command line take priority over entries read from\n                             the file.\n   --count-and-diff \u0026lt;set1\u0026gt; \u0026lt;set2\u0026gt;\n                             First perform direct code counts of source file(s)\n                             of \u0026lt;set1\u0026gt; and \u0026lt;set2\u0026gt; separately, then perform a diff\n                             of these.  Inputs may be pairs of files, directories,\n                             or archives.  If --out or --report-file is given,\n                             three output files will be created, one for each\n                             of the two counts and one for the diff.  See also\n                             --diff, --diff-alignment, --diff-timeout,\n                             --ignore-case, --ignore-whitespace.\n   --diff \u0026lt;set1\u0026gt; \u0026lt;set2\u0026gt;      Compute differences in code and comments between\n                             source file(s) of \u0026lt;set1\u0026gt; and \u0026lt;set2\u0026gt;.  The inputs\n                             may be any mix of files, directories, archives,\n                             or git commit hashes.  Use --diff-alignment to\n                             generate a list showing which file pairs where\n                             compared.  When comparing git branches, only files\n                             which have changed in either commit are compared.\n                             See also --git, --count-and-diff, --diff-alignment,\n                             --diff-list-file, --diff-timeout, --ignore-case,\n                             --ignore-whitespace.\n   --diff-timeout \u0026lt;N\u0026gt;        Ignore files which take more than \u0026lt;N\u0026gt; seconds\n                             to process.  Default is 10 seconds.  Setting \u0026lt;N\u0026gt;\n                             to 0 allows unlimited time.  (Large files with many\n                             repeated lines can cause Algorithm::Diff::sdiff()\n                             to take hours.) See also --timeout.\n   --docstring-as-code       cloc considers docstrings to be comments, but this is\n                             not always correct as docstrings represent regular\n                             strings when they appear on the right hand side of an\n                             assignment or as function arguments.  This switch\n                             forces docstrings to be counted as code.\n   --follow-links            [Unix only] Follow symbolic links to directories\n                             (sym links to files are always followed).\n                             See also --stat.\n   --force-lang=\u0026lt;lang\u0026gt;[,\u0026lt;ext\u0026gt;]\n                             Process all files that have a \u0026lt;ext\u0026gt; extension\n                             with the counter for language \u0026lt;lang\u0026gt;.  For\n                             example, to count all .f files with the\n                             Fortran 90 counter (which expects files to\n                             end with .f90) instead of the default Fortran 77\n                             counter, use\n                               --force-lang=\"Fortran 90,f\"\n                             If \u0026lt;ext\u0026gt; is omitted, every file will be counted\n                             with the \u0026lt;lang\u0026gt; counter.  This option can be\n                             specified multiple times (but that is only\n                             useful when \u0026lt;ext\u0026gt; is given each time).\n                             See also --script-lang, --lang-no-ext.\n   --force-lang-def=\u0026lt;file\u0026gt;   Load language processing filters from \u0026lt;file\u0026gt;,\n                             then use these filters instead of the built-in\n                             filters.  Note:  languages which map to the same\n                             file extension (for example:\n                             MATLAB/Mathematica/Objective-C/MUMPS/Mercury;\n                             Pascal/PHP; Lisp/OpenCL; Lisp/Julia; Perl/Prolog)\n                             will be ignored as these require additional\n                             processing that is not expressed in language\n                             definition files.  Use --read-lang-def to define\n                             new language filters without replacing built-in\n                             filters (see also --write-lang-def,\n                             --write-lang-def-incl-dup).\n   --git                     Forces the inputs to be interpreted as git targets\n                             (commit hashes, branch names, et cetera) if these\n                             are not first identified as file or directory\n                             names.  This option overrides the --vcs=git logic\n                             if this is given; in other words, --git gets its\n                             list of files to work on directly from git using\n                             the hash or branch name rather than from\n                             'git ls-files'.  This option can be used with\n                             --diff to perform line count diffs between git\n                             commits, or between a git commit and a file,\n                             directory, or archive.  Use -v/--verbose to see\n                             the git system commands cloc issues.\n   --git-diff-rel            Same as --git --diff, or just --diff if the inputs\n                             are recognized as git targets.  Only files which\n                             have changed in either commit are compared.\n   --git-diff-all            Git diff strategy #2:  compare all files in the\n                             repository between the two commits.\n   --ignore-whitespace       Ignore horizontal white space when comparing files\n                             with --diff.  See also --ignore-case.\n   --ignore-case             Ignore changes in case within file contents;\n                             consider upper- and lowercase letters equivalent\n                             when comparing files with --diff.  See also\n                             --ignore-whitespace.\n   --ignore-case-ext         Ignore case of file name extensions.  This will\n                             cause problems counting some languages\n                             (specifically, .c and .C are associated with C and\n                             C++; this switch would count .C files as C rather\n                             than C++ on *nix operating systems).  File name\n                             case insensitivity is always true on Windows.\n   --lang-no-ext=\u0026lt;lang\u0026gt;      Count files without extensions using the \u0026lt;lang\u0026gt;\n                             counter.  This option overrides internal logic\n                             for files without extensions (where such files\n                             are checked against known scripting languages\n                             by examining the first line for #!).  See also\n                             --force-lang, --script-lang.\n   --max-file-size=\u0026lt;MB\u0026gt;      Skip files larger than \u0026lt;MB\u0026gt; megabytes when\n                             traversing directories.  By default, \u0026lt;MB\u0026gt;=100.\n                             cloc's memory requirement is roughly twenty times\n                             larger than the largest file so running with\n                             files larger than 100 MB on a computer with less\n                             than 2 GB of memory will cause problems.\n                             Note:  this check does not apply to files\n                             explicitly passed as command line arguments.\n   --no-autogen[=list]       Ignore files generated by code-production systems\n                             such as GNU autoconf.  To see a list of these files\n                             (then exit), run with --no-autogen list\n                             See also --autoconf.\n   --original-dir            [Only effective in combination with\n                             --strip-comments]  Write the stripped files\n                             to the same directory as the original files.\n   --read-binary-files       Process binary files in addition to text files.\n                             This is usually a bad idea and should only be\n                             attempted with text files that have embedded\n                             binary data.\n   --read-lang-def=\u0026lt;file\u0026gt;    Load new language processing filters from \u0026lt;file\u0026gt;\n                             and merge them with those already known to cloc.\n                             If \u0026lt;file\u0026gt; defines a language cloc already knows\n                             about, cloc's definition will take precedence.\n                             Use --force-lang-def to over-ride cloc's\n                             definitions (see also --write-lang-def,\n                             --write-lang-def-incl-dup).\n   --script-lang=\u0026lt;lang\u0026gt;,\u0026lt;s\u0026gt;  Process all files that invoke \u0026lt;s\u0026gt; as a #!\n                             scripting language with the counter for language\n                             \u0026lt;lang\u0026gt;.  For example, files that begin with\n                                #!/usr/local/bin/perl5.8.8\n                             will be counted with the Perl counter by using\n                                --script-lang=Perl,perl5.8.8\n                             The language name is case insensitive but the\n                             name of the script language executable, \u0026lt;s\u0026gt;,\n                             must have the right case.  This option can be\n                             specified multiple times.  See also --force-lang,\n                             --lang-no-ext.\n   --sdir=\u0026lt;dir\u0026gt;              Use \u0026lt;dir\u0026gt; as the scratch directory instead of\n                             letting File::Temp chose the location.  Files\n                             written to this location are not removed at\n                             the end of the run (as they are with File::Temp).\n   --skip-uniqueness         Skip the file uniqueness check.  This will give\n                             a performance boost at the expense of counting\n                             files with identical contents multiple times\n                             (if such duplicates exist).\n   --stat                    Some file systems (AFS, CD-ROM, FAT, HPFS, SMB)\n                             do not have directory 'nlink' counts that match\n                             the number of its subdirectories.  Consequently\n                             cloc may undercount or completely skip the\n                             contents of such file systems.  This switch forces\n                             File::Find to stat directories to obtain the\n                             correct count.  File search speed will decrease.\n                             See also --follow-links.\n   --stdin-name=\u0026lt;file\u0026gt;       Give a file name to use to determine the language\n                             for standard input.  (Use - as the input name to\n                             receive source code via STDIN.)\n   --strip-comments=\u0026lt;ext\u0026gt;    For each file processed, write to the current\n                             directory a version of the file which has blank\n                             and commented lines removed (in-line comments\n                             persist).  The name of each stripped file is the\n                             original file name with .\u0026lt;ext\u0026gt; appended to it.\n                             It is written to the current directory unless\n                             --original-dir is on.\n   --strip-str-comments      Replace comment markers embedded in strings with\n                             'xx'.  This attempts to work around a limitation\n                             in Regexp::Common::Comment where comment markers\n                             embedded in strings are seen as actual comment\n                             markers and not strings, often resulting in a\n                             'Complex regular subexpression recursion limit'\n                             warning and incorrect counts.  There are two\n                             disadvantages to using this switch:  1/code count\n                             performance drops, and 2/code generated with\n                             --strip-comments will contain different strings\n                             where ever embedded comments are found.\n   --sum-reports             Input arguments are report files previously\n                             created with the --report-file option in plain\n                             format (eg. not JSON, YAML, XML, or SQL).\n                             Makes a cumulative set of results containing the\n                             sum of data from the individual report files.\n   --timeout \u0026lt;N\u0026gt;             Ignore files which take more than \u0026lt;N\u0026gt; seconds\n                             to process at any of the language's filter stages.\n                             The default maximum number of seconds spent on a\n                             filter stage is the number of lines in the file\n                             divided by one thousand.  Setting \u0026lt;N\u0026gt; to 0 allows\n                             unlimited time.  See also --diff-timeout.\n   --processes=NUM           [Available only on systems with a recent version\n                             of the Parallel::ForkManager module.  Not\n                             available on Windows.] Sets the maximum number of\n                             cores that cloc uses.  The default value of 0\n                             disables multiprocessing.\n   --unix                    Override the operating system autodetection\n                             logic and run in UNIX mode.  See also\n                             --windows, --show-os.\n   --use-sloccount           If SLOCCount is installed, use its compiled\n                             executables c_count, java_count, pascal_count,\n                             php_count, and xml_count instead of cloc's\n                             counters.  SLOCCount's compiled counters are\n                             substantially faster than cloc's and may give\n                             a performance improvement when counting projects\n                             with large files.  However, these cloc-specific\n                             features will not be available: --diff,\n                             --count-and-diff, --strip-comments, --unicode.\n   --windows                 Override the operating system autodetection\n                             logic and run in Microsoft Windows mode.\n                             See also --unix, --show-os.\n\n Filter Options\n   --include-content=\u0026lt;regex\u0026gt; Only count files containing text that matches the\n                             given regular expression.\n   --exclude-content=\u0026lt;regex\u0026gt; Exclude files containing text that matches the given\n                             regular expression.\n   --exclude-dir=\u0026lt;D1\u0026gt;[,D2,]  Exclude the given comma separated directories\n                             D1, D2, D3, et cetera, from being scanned.  For\n                             example  --exclude-dir=.cache,test  will skip\n                             all files and subdirectories that have /.cache/\n                             or /test/ as their parent directory.\n                             Directories named .bzr, .cvs, .hg, .git, .svn,\n                             and .snapshot are always excluded.\n                             This option only works with individual directory\n                             names so including file path separators is not\n                             allowed.  Use --fullpath and --not-match-d=\u0026lt;regex\u0026gt;\n                             to supply a regex matching multiple subdirectories.\n   --exclude-ext=\u0026lt;ext1\u0026gt;[,\u0026lt;ext2\u0026gt;[...]]\n                             Do not count files having the given file name\n                             extensions.\n   --exclude-lang=\u0026lt;L1\u0026gt;[,L2[...]]\n                             Exclude the given comma separated languages\n                             L1, L2, L3, et cetera, from being counted.\n   --exclude-list-file=\u0026lt;file\u0026gt;  Ignore files and/or directories whose names\n                             appear in \u0026lt;file\u0026gt;.  \u0026lt;file\u0026gt; should have one file\n                             name per line.  Only exact matches are ignored;\n                             relative path names will be resolved starting from\n                             the directory where cloc is invoked.\n                             See also --list-file.\n   --fullpath                Modifies the behavior of --match-f, --not-match-f,\n                             and --not-match-d to include the file's path\n                             in the regex, not just the file's basename.\n                             (This does not expand each file to include its\n                             absolute path, instead it uses as much of\n                             the path as is passed in to cloc.)\n                             Note:  --match-d always looks at the full\n                             path and therefore is unaffected by --fullpath.\n   --include-ext=\u0026lt;ext1\u0026gt;[,ext2[...]]\n                             Count only languages having the given comma\n                             separated file extensions.  Use --show-ext to\n                             see the recognized extensions.\n   --include-lang=\u0026lt;L1\u0026gt;[,L2[...]]\n                             Count only the given comma separated languages\n                             L1, L2, L3, et cetera.  Use --show-lang to see\n                             the list of recognized languages.\n   --match-d=\u0026lt;regex\u0026gt;         Only count files in directories matching the Perl\n                             regex.  For example\n                               --match-d='/(src|include)/'\n                             only counts files in directories containing\n                             /src/ or /include/.  Unlike --not-match-d,\n                             --match-f, and --not-match-f, --match-d always\n                             compares the fully qualified path against the\n                             regex.\n   --not-match-d=\u0026lt;regex\u0026gt;     Count all files except those in directories\n                             matching the Perl regex.  Only the trailing\n                             directory name is compared, for example, when\n                             counting in /usr/local/lib, only 'lib' is\n                             compared to the regex.\n                             Add --fullpath to compare parent directories to\n                             the regex.\n                             Do not include file path separators at the\n                             beginning or end of the regex.\n   --match-f=\u0026lt;regex\u0026gt;         Only count files whose basenames match the Perl\n                             regex.  For example\n                               --match-f='^[Ww]idget'\n                             only counts files that start with Widget or widget.\n                             Add --fullpath to include parent directories\n                             in the regex instead of just the basename.\n   --not-match-f=\u0026lt;regex\u0026gt;     Count all files except those whose basenames\n                             match the Perl regex.  Add --fullpath to include\n                             parent directories in the regex instead of just\n                             the basename.\n   --skip-archive=\u0026lt;regex\u0026gt;    Ignore files that end with the given Perl regular\n                             expression.  For example, if given\n                               --skip-archive='(zip|tar(.(gz|Z|bz2|xz|7z))?)'\n                             the code will skip files that end with .zip,\n                             .tar, .tar.gz, .tar.Z, .tar.bz2, .tar.xz, and\n                             .tar.7z.\n   --skip-win-hidden         On Windows, ignore hidden files.\n\n Debug Options\n   --categorized=\u0026lt;file\u0026gt;      Save file sizes in bytes, identified languages\n                             and names of categorized files to \u0026lt;file\u0026gt;.\n   --counted=\u0026lt;file\u0026gt;          Save names of processed source files to \u0026lt;file\u0026gt;.\n   --diff-alignment=\u0026lt;file\u0026gt;   Write to \u0026lt;file\u0026gt; a list of files and file pairs\n                             showing which files were added, removed, and/or\n                             compared during a run with --diff.  This switch\n                             forces the --diff mode on.\n   --explain=\u0026lt;lang\u0026gt;          Print the filters used to remove comments for\n                             language \u0026lt;lang\u0026gt; and exit.  In some cases the\n                             filters refer to Perl subroutines rather than\n                             regular expressions.  An examination of the\n                             source code may be needed for further explanation.\n   --help                    Print this usage information and exit.\n   --found=\u0026lt;file\u0026gt;            Save names of every file found to \u0026lt;file\u0026gt;.\n   --ignored=\u0026lt;file\u0026gt;          Save names of ignored files and the reason they\n                             were ignored to \u0026lt;file\u0026gt;.\n   --print-filter-stages     Print processed source code before and after\n                             each filter is applied.\n   --show-ext[=\u0026lt;ext\u0026gt;]        Print information about all known (or just the\n                             given) file extensions and exit.\n   --show-lang[=\u0026lt;lang\u0026gt;]      Print information about all known (or just the\n                             given) languages and exit.\n   --show-os                 Print the value of the operating system mode\n                             and exit.  See also --unix, --windows.\n   -v[=\u0026lt;n\u0026gt;]                  Verbose switch (optional numeric value).\n   -verbose[=\u0026lt;n\u0026gt;]            Long form of -v.\n   --version                 Print the version of this program and exit.\n   --write-lang-def=\u0026lt;file\u0026gt;   Writes to \u0026lt;file\u0026gt; the language processing filters\n                             then exits.  Useful as a first step to creating\n                             custom language definitions. Note: languages which\n                             map to the same file extension will be excluded.\n                             (See also --force-lang-def, --read-lang-def).\n   --write-lang-def-incl-dup=\u0026lt;file\u0026gt;\n                             Same as --write-lang-def, but includes duplicated\n                             extensions.  This generates a problematic language\n                             definition file because cloc will refuse to use\n                             it until duplicates are removed.\n\n Output Options\n   --3                       Print third-generation language output.\n                             (This option can cause report summation to fail\n                             if some reports were produced with this option\n                             while others were produced without it.)\n   --by-percent  X           Instead of comment and blank line counts, show\n                             these values as percentages based on the value\n                             of X in the denominator:\n                                X = 'c'   -\u0026gt; # lines of code\n                                X = 'cm'  -\u0026gt; # lines of code + comments\n                                X = 'cb'  -\u0026gt; # lines of code + blanks\n                                X = 'cmb' -\u0026gt; # lines of code + comments + blanks\n                             For example, if using method 'c' and your code\n                             has twice as many lines of comments as lines\n                             of code, the value in the comment column will\n                             be 200%.  The code column remains a line count.\n   --csv                     Write the results as comma separated values.\n   --csv-delimiter=\u0026lt;C\u0026gt;       Use the character \u0026lt;C\u0026gt; as the delimiter for comma\n                             separated files instead of ,.  This switch forces --csv to be on.\n   --file-encoding=\u0026lt;E\u0026gt;       Write output files using the \u0026lt;E\u0026gt; encoding instead of\n                             the default ASCII (\u0026lt;E\u0026gt; = 'UTF-7').  Examples: 'UTF-16',\n                             'euc-kr', 'iso-8859-16'.  Known encodings can be\n                             printed with\n                               perl -MEncode -e 'print join(\"\\n\", Encode-\u0026gt;encodings(\":all\")), \"\\n\"'\n   --hide-rate               Do not show line and file processing rates in the\n                             output header. This makes output deterministic.\n   --json                    Write the results as JavaScript Object Notation\n                             (JSON) formatted output.\n   --md                      Write the results as Markdown-formatted text.\n   --out=\u0026lt;file\u0026gt;              Synonym for --report-file=\u0026lt;file\u0026gt;.\n   --progress-rate=\u0026lt;n\u0026gt;       Show progress update after every \u0026lt;n\u0026gt; files are\n                             processed (default \u0026lt;n\u0026gt;=100).  Set \u0026lt;n\u0026gt; to 0 to\n                             suppress progress output (useful when redirecting\n                             output to STDOUT).\n   --quiet                   Suppress all information messages except for\n                             the final report.\n   --report-file=\u0026lt;file\u0026gt;      Write the results to \u0026lt;file\u0026gt; instead of STDOUT.\n   --sql=\u0026lt;file\u0026gt;              Write results as SQL create and insert statements\n                             which can be read by a database program such as\n                             SQLite.  If \u0026lt;file\u0026gt; is -, output is sent to STDOUT.\n   --sql-append              Append SQL insert statements to the file specified\n                             by --sql and do not generate table creation\n                             statements.  Only valid with the --sql option.\n   --sql-project=\u0026lt;name\u0026gt;      Use \u0026lt;name\u0026gt; as the project identifier for the\n                             current run.  Only valid with the --sql option.\n   --sql-style=\u0026lt;style\u0026gt;       Write SQL statements in the given style instead\n                             of the default SQLite format.  Styles include\n                             'Oracle' and 'Named_Columns'.\n   --sum-one                 For plain text reports, show the SUM: output line\n                             even if only one input file is processed.\n   --xml                     Write the results in XML.\n   --xsl=\u0026lt;file\u0026gt;              Reference \u0026lt;file\u0026gt; as an XSL stylesheet within\n                             the XML output.  If \u0026lt;file\u0026gt; is 1 (numeric one),\n                             writes a default stylesheet, cloc.xsl (or\n                             cloc-diff.xsl if --diff is also given).\n                             This switch forces --xml on.\n   --yaml                    Write the results in YAML.\n\u003c/pre\u003e\n[](1}}})\n\u003ca name=\"Languages\"\u003e\u003c/a\u003e []({{{1)\n# [Recognized Languages \u0026#9650;](#___top \"click to go to top of document\")\n\n\u003cpre\u003e\nprompt\u003e cloc --show-lang\n\nABAP                       (abap)\nActionScript               (as)\nAda                        (ada, adb, ads, pad)\nADSO/IDSM                  (adso)\nAgda                       (agda, lagda)\nAMPLE                      (ample, dofile, startup)\nAnsProlog                  (lp)\nAnt                        (build.xml, build.xml)\nANTLR Grammar              (g, g4)\nApex Class                 (cls)\nApex Trigger               (trigger)\nAPL                        (apl, apla, aplc, aplf, apli, apln, aplo, dyalog, dyapp, mipage)\nAppleScript                (applescript)\nArduino Sketch             (ino)\nArkTs                      (ets)\nArturo                     (art)\nAsciiDoc                   (adoc, asciidoc)\nASP                        (asa, ashx, asp, axd)\nASP.NET                    (asax, ascx, asmx, aspx, master, sitemap, webinfo)\nAspectJ                    (aj)\nAssembly                   (a51, asm, nasm, S, s)\nAstro                      (astro)\nAsymptote                  (asy)\nAutoHotkey                 (ahk, ahkl)\nawk                        (auk, awk, gawk, mawk, nawk)\nBazel                      (BUILD)\nBizTalk Orchestration      (odx)\nBizTalk Pipeline           (btp)\nBlade                      (blade, blade.php)\nBourne Again Shell         (bash)\nBourne Shell               (sh)\nBrightScript               (brs)\nbuilder                    (xml.builder)\nC                          (c, cats, ec, idc, pgc)\nC Shell                    (csh, tcsh)\nC#                         (cs)\nC# Designer                (designer.cs)\nC++                        (C, c++, c++m, cc, ccm, CPP, cpp, cppm, cxx, cxxm, h++, inl, ipp, ixx, pcc, tcc, tpp)\nC/C++ Header               (H, h, hh, hpp, hxx)\nCairo                      (cairo)\nCake Build Script          (cake)\nCarbon                     (carbon)\nCCS                        (ccs)\nChapel                     (chpl)\nCircom                     (circom)\nClean                      (dcl, icl)\nClojure                    (boot, cl2, clj, cljs.hl, cljscm, cljx, hic, riemann.config)\nClojureC                   (cljc)\nClojureScript              (cljs)\nCMake                      (cmake, cmake.in, CMakeLists.txt)\nCOBOL                      (CBL, cbl, ccp, COB, cob, cobol, cpy)\nCoCoA 5                    (c5, cocoa5, cocoa5server, cpkg5)\nCoffeeScript               (_coffee, cakefile, cjsx, coffee, iced)\nColdFusion                 (cfm, cfml)\nColdFusion CFScript        (cfc)\nConstraint Grammar         (cg3, rlx)\nContainerfile              (Containerfile)\nCoq                        (v)\nCrystal                    (cr)\nCSON                       (cson)\nCSS                        (css)\nCSV                        (csv)\nCucumber                   (feature)\nCUDA                       (cu, cuh)\nCython                     (pxd, pxi, pyx)\nD                          (d)\nDafny                      (dfy)\nDAL                        (da)\nDart                       (dart)\nDelphi Form                (dfm)\nDenizenScript              (dsc)\nDerw                       (derw)\ndhall                      (dhall)\nDIET                       (dt)\ndiff                       (diff, patch)\nDITA                       (dita)\nDockerfile                 (Dockerfile, dockerfile)\nDOORS Extension Language   (dxl)\nDOS Batch                  (BAT, bat, BTM, btm, CMD, cmd)\nDrools                     (drl)\nDTD                        (dtd)\ndtrace                     (d)\nECPP                       (ecpp)\nEEx                        (eex)\nEJS                        (ejs)\nElixir                     (ex, exs)\nElm                        (elm)\nEmbedded Crystal           (ecr)\nERB                        (ERB, erb)\nErlang                     (app.src, emakefile, erl, hrl, rebar.config, rebar.config.lock, rebar.lock, xrl, yrl)\nExpect                     (exp)\nF#                         (fsi, fs, fs)\nF# Script                  (fsx)\nFennel                     (fnl)\nFinite State Language      (fsl, jssm)\nFish Shell                 (fish)\nFlatbuffers                (fbs)\nFocus                      (focexec)\nForth                      (4th, e4, f83, fb, forth, fpm, fr, frt, ft, fth, rx, fs, f, for)\nFortran 77                 (F, F77, f77, FOR, FTN, ftn, pfo, f, for)\nFortran 90                 (F90, f90)\nFortran 95                 (F95, f95)\nFreemarker Template        (ftl)\nFuthark                    (fut)\nFXML                       (fxml)\nGDScript                   (gd)\nGencat NLS                 (msg)\nGlade                      (glade, ui)\nGleam                      (gleam)\nGlimmer JavaScript         (gjs)\nGlimmer TypeScript         (gts)\nGLSL                       (comp, fp, frag, frg, fsh, fshader, geo, geom, glsl, glslv, gshader, tesc, tese, vert, vrx, vsh, vshader)\nGo                         (go, ʕ◔ϖ◔ʔ)\nGodot Resource             (tres)\nGodot Scene                (tscn)\nGodot Shaders              (gdshader)\nGradle                     (gradle, gradle.kts)\nGrails                     (gsp)\nGraphQL                    (gql, graphql, graphqls)\nGroovy                     (gant, groovy, grt, gtpl, gvy, jenkinsfile)\nHaml                       (haml, haml.deface)\nHandlebars                 (handlebars, hbs)\nHarbour                    (hb)\nHare                       (ha)\nHaskell                    (hs, hsc, lhs)\nHaxe                       (hx, hxsl)\nHCL                        (hcl, nomad, tf, tfvars)\nHLSL                       (cg, cginc, fxh, hlsl, hlsli, shader)\nHolyC                      (HC)\nHoon                       (hoon)\nHTML                       (htm, html, html.hl, xht)\nHTML EEx                   (heex)\nIDL                        (dlm, idl, pro)\nIdris                      (idr)\nIgor Pro                   (ipf)\nImba                       (imba)\nINI                        (buildozer.spec, editorconfig, ini, lektorproject, prefs)\nInstallShield              (ism)\nIPL                        (ipl)\nJai                        (jai)\nJanet                      (janet)\nJava                       (java)\nJavaScript                 (_js, bones, cjs, es6, jake, jakefile, js, jsb, jscad, jsfl, jsm, jss, mjs, njs, pac, sjs, ssjs, xsjs, xsjslib)\nJavaServer Faces           (jsf)\nJCL                        (jcl)\nJinja Template             (j2, jinja, jinja2)\nJSON                       (arcconfig, avsc, composer.lock, geojson, gltf, har, htmlhintrc, json, json-tmlanguage, jsonl, mcmeta, mcmod.info, tern-config, tern-project, tfstate, tfstate.backup, topojson, watchmanconfig, webapp, webmanifest, yyp)\nJSON5                      (json5)\nJSP                        (jsp, jspf)\nJSX                        (jsx)\nJulia                      (jl)\nJuniper Junos              (junos)\nJupyter Notebook           (ipynb)\nKermit                     (ksc)\nKorn Shell                 (ksh)\nKotlin                     (kt, ktm, kts)\nkvlang                     (kv)\nLean                       (hlean, lean)\nLem                        (lem)\nLESS                       (less)\nlex                        (l, lex)\nLFE                        (lfe)\nLinker Script              (ld)\nliquid                     (liquid)\nLisp                       (asd, el, lisp, lsp, cl, jl)\nLiterate Idris             (lidr)\nLiveLink OScript           (oscript)\nLLVM IR                    (ll)\nLogos                      (x, xm)\nLogtalk                    (lgt, logtalk)\nLua                        (lua, nse, p8, pd_lua, rbxs, wlua)\nLuau                       (luau)\nm4                         (ac, m4)\nmake                       (am, Gnumakefile, gnumakefile, Makefile, makefile, mk)\nMako                       (mako, mao)\nMarkdown                   (contents.lr, markdown, md, mdown, mdwn, mdx, mkd, mkdn, mkdown, ronn, workbook)\nMathematica                (cdf, ma, mathematica, mt, nbp, wl, wlt, m)\nMATLAB                     (m)\nMaven                      (pom, pom.xml)\nMeson                      (meson.build)\nMetal                      (metal)\nModelica                   (mo)\nModula3                    (i3, ig, m3, mg)\nMojo                       (mojo, 🔥)\nMojom                      (mojom)\nMoonBit                    (mbt, mbti, mbtx, mbty)\nMSBuild script             (btproj, csproj, msbuild, vcproj, wdproj, wixproj)\nMUMPS                      (mps, m)\nMustache                   (mustache)\nMXML                       (mxml)\nNAnt script                (build)\nNASTRAN DMAP               (dmap)\nNemerle                    (n)\nNetLogo                    (nlogo, nls)\nNickel                     (ncl)\nNim                        (nim, nim.cfg, nimble, nimrod, nims)\nNix                        (nix)\nNunjucks                   (njk)\nObjective-C                (m)\nObjective-C++              (mm)\nOCaml                      (eliom, eliomi, ml, ml4, mli, mll, mly)\nOdin                       (odin)\nOpenCL                     (cl)\nOpenSCAD                   (scad)\nOracle Forms               (fmt)\nOracle PL/SQL              (bod, fnc, prc, spc, trg)\nOracle Reports             (rex)\nP4                         (p4)\nPascal                     (dpr, lpr, pas, pascal)\nPascal/Pawn                (p)\nPascal/Puppet              (pp)\nPatran Command Language    (pcl, ses)\nPawn                       (pawn, pwn)\nPEG                        (peg)\npeg.js                     (pegjs)\npeggy                      (peggy)\nPerl                       (ack, al, cpanfile, makefile.pl, perl, ph, plh, plx, pm, psgi, rexfile, pl, p6)\nPest                       (pest)\nPHP                        (aw, ctp, phakefile, php, php3, php4, php5, php_cs, php_cs.dist, phps, phpt, phtml)\nPHP/Pascal/Fortran/Pawn    (inc)\nPig Latin                  (pig)\nPL/I                       (pl1)\nPL/M                       (lit, plm)\nPlantUML                   (iuml, plantuml, pu, puml, wsd)\nPO File                    (po)\nPony                       (pony)\nPowerBuilder               (pbt, sra, srf, srm, srs, sru, srw)\nPowerShell                 (ps1, psd1, psm1)\nPrisma Schema              (prisma)\nProcessing                 (pde)\nProGuard                   (pro)\nProlog                     (P, prolog, yap, pl, p6, pro)\nProperties                 (properties)\nProtocol Buffers           (proto)\nPRQL                       (prql)\nPug                        (jade, pug)\nPureScript                 (purs)\nPython                     (buck, build.bazel, gclient, gyp, gypi, lmi, py, py3, pyde, pyi, pyp, pyt, pyw, sconscript, sconstruct, snakefile, tac, workspace, wscript, wsgi, xpy)\nQML                        (qbs, qml)\nQt                         (ui)\nQt Linguist                (ts)\nQt Project                 (pro)\nR                          (expr-dist, R, r, rd, rprofile, rsx)\nRacket                     (rkt, rktd, rktl, scrbl)\nRaku                       (pm6, raku, rakumod)\nRaku/Prolog                (P6, p6)\nRAML                       (raml)\nRapydScript                (pyj)\nRazor                      (cshtml, razor)\nReasonML                   (re, rei)\nReScript                   (res, resi)\nreStructuredText           (rest, rest.txt, rst, rst.txt)\nRexx                       (pprx, rexx)\nRing                       (rform, rh, ring)\nRmd                        (Rmd)\nRobotFramework             (robot)\nRuby                       (appraisals, berksfile, brewfile, builder, buildfile, capfile, dangerfile, deliverfile, eye, fastfile, gemfile, gemfile.lock, gemspec, god, guardfile, irbrc, jarfile, jbuilder, mavenfile, mspec, podfile, podspec, pryrc, puppetfile, rabl, rake, rb, rbuild, rbw, rbx, ru, snapfile, thor, thorfile, vagrantfile, watchr)\nRuby HTML                  (rhtml)\nRust                       (rs, rs.in)\nSaltStack                  (sls)\nSAS                        (sas)\nSass                       (sass)\nScala                      (kojo, sbt, scala)\nScheme                     (sc, sch, scm, sld, sps, ss, sls)\nSCSS                       (scss)\nsed                        (sed)\nSKILL                      (il)\nSKILL++                    (ils)\nSlice                      (ice)\nSlim                       (slim)\nSlint                      (slint)\nSmalltalk                  (st, cs)\nSmarty                     (smarty, tpl)\nSnakemake                  (rules, smk)\nSoftbridge Basic           (SBL, sbl)\nSolidity                   (sol)\nSparForte                  (sp)\nSpecman e                  (e)\nSQL                        (cql, mysql, psql, SQL, sql, tab, udf, viw)\nSQL Data                   (data.sql)\nSQL Stored Procedure       (spc.sql, spoc.sql, sproc.sql, udf.sql)\nSquirrel                   (nut)\nStandard ML                (fun, sig, sml)\nStarlark                   (bazel, bzl)\nStata                      (ado, DO, do, doh, ihlp, mata, matah, sthlp)\nStylus                     (styl)\nSugarSS                    (sss)\nSvelte                     (svelte)\nSVG                        (SVG, svg)\nSwift                      (swift)\nSWIG                       (i)\nTableGen                   (td)\nTcl/Tk                     (itk, tcl, tk)\nTEAL                       (teal)\nTeamcenter met             (met)\nTeamcenter mth             (mth)\nTempl                      (templ)\nTeX                        (aux, bbx, bib, bst, cbx, dtx, ins, lbx, ltx, mkii, mkiv, mkvi, sty, tex, cls)\nText                       (text, txt)\nThrift                     (thrift)\nTITAN Project File Information (tpd)\nTitanium Style Sheet       (tss)\nTLA+                       (tla)\nTNSDL                      (cii, cin, in1, in2, in3, in4, inf, interface, rou, sdl, sdt, spd, ssc, sst)\nTOML                       (toml)\ntspeg                      (jspeg, tspeg)\nTTCN                       (ttcn, ttcn2, ttcn3, ttcnpp)\nTwig                       (twig)\nTypeScript                 (mts, tsx, ts)\nTypst                      (typ)\nUmka                       (um)\nUnity-Prefab               (mat, prefab)\nVala                       (vala)\nVala Header                (vapi)\nVB for Applications        (VBA, vba)\nVelocity Template Language (vm)\nVerilog-SystemVerilog      (sv, svh, v)\nVHDL                       (VHD, vhd, VHDL, vhdl, vhf, vhi, vho, vhs, vht, vhw)\nvim script                 (vim)\nVisual Basic               (BAS, bas, ctl, dsr, frm, FRX, frx, VBHTML, vbhtml, vbp, vbw, cls)\nVisual Basic .NET          (VB, vb, vbproj)\nVisual Basic Script        (VBS, vbs)\nVisual Fox Pro             (SCA, sca)\nVisual Studio Solution     (sln)\nVisualforce Component      (component)\nVisualforce Page           (page)\nVuejs Component            (vue)\nVyper                      (vy)\nWeb Services Description   (wsdl)\nWebAssembly                (wast, wat)\nWGSL                       (wgsl)\nWindows Message File       (mc)\nWindows Module Definition  (def)\nWindows Resource File      (rc, rc2)\nWiX include                (wxi)\nWiX source                 (wxs)\nWiX string localization    (wxl)\nWXML                       (wxml)\nWXSS                       (wxss)\nX++                        (xpo)\nXAML                       (xaml)\nxBase                      (prg, prw)\nxBase Header               (ch)\nXHTML                      (xhtml)\nXMI                        (XMI, xmi)\nXML                        (adml, admx, ant, app.config, axml, builds, ccproj, ccxml, classpath, clixml, cproject, cscfg, csdef, csl, ct, depproj, ditamap, ditaval, dll.config, dotsettings, filters, fsproj, gmx, grxml, iml, ivy, jelly, jsproj, kml, launch, mdpolicy, mjml, natvis, ndproj, nproj, nuget.config, nuspec, odd, osm, packages.config, pkgproj, plist, proj, project, props, ps1xml, psc1, pt, rdf, resx, rss, scxml, settings.stylecop, sfproj, shproj, srdf, storyboard, sttheme, sublime-snippet, targets, tmcommand, tml, tmlanguage, tmpreferences, tmsnippet, tmtheme, urdf, ux, vcxproj, vsixmanifest, vssettings, vstemplate, vxml, web.config, web.debug.config, web.release.config, wsf, x3d, xacro, xib, xlf, xliff, XML, xml, xml.dist, xproj, xspec, xul, zcml)\nXQuery                     (xq, xql, xqm, xquery, xqy)\nXSD                        (XSD, xsd)\nXSLT                       (XSL, xsl, XSLT, xslt)\nXtend                      (xtend)\nyacc                       (y, yacc)\nYAML                       (clang-format, clang-tidy, gemrc, glide.lock, mir, reek, rviz, sublime-syntax, syntax, yaml, yaml-tmlanguage, yml, yml.mysql)\nYang                       (yang)\nZig                        (zig)\nzsh                        (zsh)\n\u003c/pre\u003e\n\nThe above list can be customized by reading language definitions from a\nfile with the `--read-lang-def` or `--force-lang-def` options.\n\nThese file extensions map to multiple languages:\n\n*   `cj`  files could be Clojure or Cangjie\n*   `cl`  files could be Lisp or OpenCL\n*   `cls` files could be Visual Basic, TeX or Apex Class\n*   `cs`  files could be C# or Smalltalk\n*   `d`   files could be D or dtrace\n*   `f`   files could be Fortran 77 or Forth\n*   `fnc` files could be Oracle PL or SQL\n*   `for` files could be Fortran 77 or Forth\n*   `fs`  files could be F# or Forth\n*   `inc` files could be PHP or Pascal\n*   `itk` files could be Tcl or Tk\n*   `jl`  files could be Lisp or Julia\n*   `lit` files could be PL or M\n*   `m`   files could be MATLAB, Mathematica, Objective-C, MUMPS or Mercury\n*   `p6`  files could be Perl or Prolog\n*   `pl`  files could be Perl or Prolog\n*   `PL`  files could be Perl or Prolog\n*   `pp`  files could be Pascal or Puppet\n*   `pro` files could be IDL, Qt Project, Prolog or ProGuard\n*   `ts`  files could be TypeScript or Qt Linguist\n*   `ui`  files could be Qt or Glade\n*   `v`   files could be Verilog-SystemVerilog or Coq\n\ncloc has subroutines that attempt to identify the correct language based\non the file's contents for these special cases. Language identification\naccuracy is a function of how much code the file contains; .m files with\njust one or two lines for example, seldom have enough information to\ncorrectly distinguish between MATLAB, Mercury, MUMPS, or Objective-C.\n\nLanguages with file extension collisions are difficult to customize with\n`--read-lang-def` or `--force-lang-def` as they have no mechanism to\nidentify languages with common extensions. In this situation one must\nmodify the cloc source code.\n[](1}}})\n\u003ca name=\"How_it_works\"\u003e\u003c/a\u003e []({{{1)\n# [How It Works \u0026#9650;](#___top \"click to go to top of document\")\n\ncloc's method of operation resembles SLOCCount's: First, create a list\nof files to consider. Next, attempt to determine whether or not found\nfiles contain recognized computer language source code. Finally, for\nfiles identified as source files, invoke language-specific routines to\ncount the number of source lines.\n\nA more detailed description:\n\n1.  If the input file is an archive (such as a .tar.gz or .zip file),\n    create a temporary directory and expand the archive there using a\n    system call to an appropriate underlying utility (tar, bzip2, unzip,\n    etc) then add this temporary directory as one of the inputs. (This\n    works more reliably on Unix than on Windows.)\n2.  Use File::Find to recursively descend the input directories and make\n    a list of candidate file names. Ignore binary and zero-sized files.\n3.  Make sure the files in the candidate list have unique contents\n    (first by comparing file sizes, then, for similarly sized files,\n    compare MD5 hashes of the file contents with Digest::MD5). For each\n    set of identical files, remove all but the first copy, as determined\n    by a lexical sort, of identical files from the set. The removed\n    files are not included in the report. (The `--skip-uniqueness` switch\n    disables the uniqueness tests and forces all copies of files to be\n    included in the report.) See also the `--ignored=` switch to see which\n    files were ignored and why.\n4.  Scan the candidate file list for file extensions which cloc\n    associates with programming languages (see the `--show-lang` and\n    `--show-ext` options). Files which match are classified as\n    containing source\n    code for that language. Each file without an extension is opened\n    and its first line read to see if it is a Unix shell script\n    (anything that begins with #!). If it is shell script, the file is\n    classified by that scripting language (if the language is\n    recognized). If the file does not have a recognized extension or is\n    not a recognized scripting language, the file is ignored.\n5.  All remaining files in the candidate list should now be source files\n    for known programming languages. For each of these files:\n\n    1.  Read the entire file into memory.\n    2.  Count the number of lines (= L\u003csub\u003eoriginal\u003c/sub\u003e).\n    3.  Remove blank lines, then count again (= L\u003csub\u003enon_blank\u003c/sub\u003e).\n    4.  Loop over the comment filters defined for this language. (For\n        example, C++ has two filters: (1) remove lines that start with\n        optional whitespace followed by // and (2) remove text between\n        /* and */) Apply each filter to the code to remove comments.\n        Count the left over lines (= L\u003csub\u003ecode\u003c/sub\u003e).\n    5.  Save the counts for this language:\n        * blank lines = L\u003csub\u003eoriginal\u003c/sub\u003e - L\u003csub\u003enon_blank\u003c/sub\u003e\n        * comment lines = L\u003csub\u003enon_blank\u003c/sub\u003e - L\u003csub\u003ecode\u003c/sub\u003e\n        * code lines = L\u003csub\u003ecode\u003c/sub\u003e\n\nThe options modify the algorithm slightly. The `--read-lang-def` option\nfor example allows the user to read definitions of comment filters,\nknown file extensions, and known scripting languages from a file. The\ncode for this option is processed between Steps 2 and 3.\n[](1}}})\n\u003ca name=\"Advanced_Use\"\u003e\u003c/a\u003e []({{{1)\n# [Advanced Use \u0026#9650;](#___top \"click to go to top of document\")\n[](1}}})\n\u003ca name=\"strip_comments\"\u003e\u003c/a\u003e []({{{1)\n##  [Remove Comments from Source Code \u0026#9650;](#___top \"click to go to top of document\")\n\nHow can you tell if cloc correctly identifies comments? One way to\nconvince yourself cloc is doing the right thing is to use its\n`--strip-comments` option to remove comments and blank lines from files, then\ncompare the stripped-down files to originals.\n\nLet's try this out with the SQLite amalgamation, a C file containing all\ncode needed to build the SQLite library along with a header file:\n\n\u003cpre\u003e\nprompt\u003e tar zxf sqlite-amalgamation-3.5.6.tar.gz\nprompt\u003e cd sqlite-3.5.6/\nprompt\u003e cloc --strip-comments=nc sqlite.c\n       1 text file.\n       1 unique file.\nWrote sqlite3.c.nc\n       0 files ignored.\n\nhttp://cloc.sourceforge.net v 1.03  T=1.0 s (1.0 files/s, 82895.0 lines/s)\n-------------------------------------------------------------------------------\nLanguage          files     blank   comment      code    scale   3rd gen. equiv\n-------------------------------------------------------------------------------\nC                     1      5167     26827     50901 x   0.77 =       39193.77\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\nThe extension argument given to --strip-comments is arbitrary; here nc was used as an abbreviation for \"no comments\".\n\ncloc removed over 31,000 lines from the file:\n\n\u003cpre\u003e\nprompt\u003e wc -l sqlite3.c sqlite3.c.nc\n  82895 sqlite3.c\n  50901 sqlite3.c.nc\n 133796 total\nprompt\u003e echo \"82895 - 50901\" | bc\n31994\n\u003c/pre\u003e\n\nWe can now compare the original file, sqlite3.c and the one stripped of\ncomments, sqlite3.c.nc with tools like diff or vimdiff and see what\nexactly cloc considered comments and blank lines. A rigorous proof that\nthe stripped-down file contains the same C code as the original is to\ncompile these files and compare checksums of the resulting object files.\n\nFirst, the original source file:\n\n\u003cpre\u003e\nprompt\u003e gcc -c sqlite3.c\nprompt\u003e md5sum sqlite3.o\ncce5f1a2ea27c7e44b2e1047e2588b49  sqlite3.o\n\u003c/pre\u003e\n\nNext, the version without comments:\n\n\u003cpre\u003e\nprompt\u003e mv sqlite3.c.nc sqlite3.c\nprompt\u003e gcc -c sqlite3.c\nprompt\u003e md5sum sqlite3.o\ncce5f1a2ea27c7e44b2e1047e2588b49  sqlite3.o\n\u003c/pre\u003e\n\ncloc removed over 31,000 lines of comments and blanks but did not modify the source code in any significant way since the resulting object file matches the original.\n[](1}}})\n\u003ca name=\"compressed_arch\"\u003e\u003c/a\u003e []({{{1)\n##  [Work with Compressed Archives \u0026#9650;](#___top \"click to go to top of document\")\nVersions of cloc before v1.07 required an\n `--extract-with=CMD` option to tell cloc how\nto expand an archive file.  Beginning with v1.07 this is extraction is\nattempted automatically.  At the moment the automatic extraction method works\nreasonably well on Unix-type OS's for the following file types:\n`.tar.gz`,\n`.tar.bz2`,\n`.tar.xz`,\n`.tgz`,\n`.zip`,\n`.ear`,\n`.deb`.\nSome of these extensions work on Windows if one has WinZip installed\nin the default location (`C:\\Program Files\\WinZip\\WinZip32.exe`).\nAdditionally, with newer versions of WinZip, the\n[http://www.winzip.com/downcl.htm](command line add-on)\nis needed for correct operation; in this case one would invoke cloc with\nsomething like \u003cbr\u003e\n\u003cpre\u003e\n --extract-with=\"\\\"c:\\Program Files\\WinZip\\wzunzip\\\" -e -o \u0026gt;FILE\u0026lt; .\"\n \u003c/code\u003e\n\u003c/pre\u003e\nRef. http://sourceforge.net/projects/cloc/forums/forum/600963/topic/4021070?message=8938196\n\nIn situations where the automatic extraction fails, one can try the\n`--extract-with=CMD`\noption to count lines of code within tar files, Zip files, or\nother compressed archives for which one has an extraction tool.\ncloc takes the user-provided extraction command and expands the archive\nto a temporary directory (created with File::Temp),\ncounts the lines of code in the temporary directory,\nthen removes that directory.  While not especially helpful when dealing\nwith a single compressed archive (after all, if you're going to type\nthe extraction command anyway why not just manually expand the archive?)\nthis option is handy for working with several archives at once.\n\nFor example, say you have the following source tarballs on a Unix machine\u003cbr\u003e\n\n    perl-5.8.5.tar.gz\n    Python-2.4.2.tar.gz\n\nand you want to count all the code within them.  The command would be\n\u003cpre\u003e\ncloc --extract-with='gzip -dc \u0026gt;FILE\u0026lt; | tar xf -' perl-5.8.5.tar.gz Python-2.4.2.tar.gz\n\u003c/pre\u003e\nIf that Unix machine has GNU tar (which can uncompress and extract in\none step) the command can be shortened to\n\u003cpre\u003e\ncloc --extract-with='tar zxf \u0026gt;FILE\u0026lt;' perl-5.8.5.tar.gz Python-2.4.2.tar.gz\n\u003c/pre\u003e\nOn a Windows computer with WinZip installed in\n`c:\\Program Files\\WinZip` the command would look like\n\u003cpre\u003e\ncloc.exe --extract-with=\"\\\"c:\\Program Files\\WinZip\\WinZip32.exe\\\" -e -o \u0026gt;FILE\u0026lt; .\" perl-5.8.5.tar.gz Python-2.4.2.tar.gz\n\u003c/pre\u003e\nJava `.ear` files are Zip files that contain additional Zip\nfiles.  cloc can handle nested compressed archives without\ndifficulty--provided all such files are compressed and archived in the\nsame way.  Examples of counting a\nJava `.ear` file in Unix and Windows:\n\u003cpre\u003e\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cloc --extract-with=\"unzip -d . \u0026gt;FILE\u0026lt; \" Project.ear\n\u003ci\u003eDOS\u0026gt;\u003c/i\u003e cloc.exe --extract-with=\"\\\"c:\\Program Files\\WinZip\\WinZip32.exe\\\" -e -o \u0026gt;FILE\u0026lt; .\" Project.ear\n\u003c/pre\u003e\n\n[](1}}})\n\u003ca name=\"diff\"\u003e\u003c/a\u003e []({{{1)\n##  [Differences \u0026#9650;](#___top \"click to go to top of document\")\nThe `--diff` switch allows one to measure the relative change in\nsource code and comments between two versions of a file, directory,\nor archive.  Differences reveal much more than absolute code\ncounts of two file versions.  For example, say a source file\nhas 100 lines and its developer delivers a newer version with\n102 lines.  Did the developer add two comment lines,\nor delete seventeen source\nlines and add fourteen source lines and five comment lines, or did\nthe developer\ndo a complete rewrite, discarding all 100 original lines and\nadding 102 lines of all new source?  The diff option tells how\nmany lines of source were added, removed, modified or stayed\nthe same, and how many lines of comments were added, removed,\nmodified or stayed the same.\n\nDifferences in blank lines are handled much more coarsely\nbecause these are stripped by cloc early on.  Unless a\nfile pair is identical, cloc will report only differences\nin absolute counts of blank lines.  In other words, one\ncan expect to see only entries for 'added' if the second\nfile has more blanks than the first, and 'removed' if the\nsituation is reversed.  The entry for 'same' will be non-zero\nonly when the two files are identical.\n\nIn addition to file pairs, one can give cloc pairs of\ndirectories, or pairs of file archives, or a file archive\nand a directory.  cloc will try to align\nfile pairs within the directories or archives and compare diffs\nfor each pair.  For example, to see what changed between\nGCC 4.4.0 and 4.5.0 one could do\n\u003cpre\u003e\ncloc --diff gcc-4.4.0.tar.bz2  gcc-4.5.0.tar.bz2\n\u003c/pre\u003e\n\nBe prepared to wait a while for the results though; the `--diff`\noption runs much more slowly than an absolute code count.\n\nTo see how cloc aligns files between the two archives, use the\n`--diff-alignment` option\n\u003cpre\u003e\ncloc --diff-alignment=align.txt gcc-4.4.0.tar.bz2  gcc-4.5.0.tar.bz2\n\u003c/pre\u003e\nto produce the file `align.txt` which shows the file pairs as well\nas files added and deleted.  The symbols `==` and `!=` before each\nfile pair indicate if the files are identical (`==`)\nor if they have different content (`!=`).\n\nHere's sample output showing the difference between the Python 2.6.6 and 2.7\nreleases:\n\u003cpre\u003e\u003ci\u003eprompt\u0026gt;\u003c/i\u003e cloc --diff Python-2.7.9.tgz Python-2.7.10.tar.xz\n    4315 text files.\n    4313 text files.s\n    2173 files ignored.\n\n4 errors:\nDiff error, exceeded timeout:  /tmp/8ToGAnB9Y1/Python-2.7.9/Mac/Modules/qt/_Qtmodule.c\nDiff error, exceeded timeout:  /tmp/M6ldvsGaoq/Python-2.7.10/Mac/Modules/qt/_Qtmodule.c\nDiff error (quoted comments?):  /tmp/8ToGAnB9Y1/Python-2.7.9/Mac/Modules/qd/qdsupport.py\nDiff error (quoted comments?):  /tmp/M6ldvsGaoq/Python-2.7.10/Mac/Modules/qd/qdsupport.py\n\nhttps://github.com/AlDanial/cloc v 1.65  T=298.59 s (0.0 files/s, 0.0 lines/s)\n-----------------------------------------------------------------------------\nLanguage                   files          blank        comment           code\n-----------------------------------------------------------------------------\nVisual Basic\n same                          2              0              1             12\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nmake\n same                         11              0            340           2952\n modified                      1              0              0              1\n added                         0              0              0              0\n removed                       0              0              0              0\ndiff\n same                          1              0             87            105\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nCSS\n same                          0              0             19            327\n modified                      1              0              0              1\n added                         0              0              0              0\n removed                       0              0              0              0\nObjective-C\n same                          7              0             61            635\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nNAnt script\n same                          2              0              0             30\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nXML\n same                          3              0              2             72\n modified                      1              0              0              1\n added                         0              0              0              1\n removed                       0              1              0              0\nWindows Resource File\n same                          3              0             56            206\n modified                      1              0              0              1\n added                         0              0              0              0\n removed                       0              0              0              0\nExpect\n same                          6              0            161            565\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nHTML\n same                         14              0             11           2344\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nvim script\n same                          1              0              7            106\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nC++\n same                          2              0             18            128\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nWindows Module Definition\n same                          7              0            187           2080\n modified                      2              0              0              0\n added                         0              0              0              1\n removed                       0              1              0              2\nProlog\n same                          1              0              0             24\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nJavascript\n same                          3              0             49            229\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nAssembly\n same                         51              0           6794          12298\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nBourne Shell\n same                         41              0           7698          45024\n modified                      1              0              0              3\n added                         0             13              2             64\n removed                       0              0              0              0\nDOS Batch\n same                         29              0            107            494\n modified                      1              0              0              9\n added                         0              1              0              3\n removed                       0              0              0              0\nMSBuild script\n same                         77              0              3          38910\n modified                      0              0              0              0\n added                         0              0              0              0\n removed                       0              0              0              0\nPython\n same                       1947              0         109012         430335\n modified                    192              0             94            950\n added                         2            323            283           2532\n removed                       2             55             58            646\nm4\n same                         18              0            191          15352\n modified                      1              0              0              2\n added                         1             31              0            205\n removed                       0              0              0              0\nC\n same                        505              0          37439         347837\n modified                     45              0             13            218\n added                         0             90             33            795\n removed                       0              9              2            148\nC/C++ Header\n same                        255              0          10361          66635\n modified                      5              0              5              7\n added                         0              1              3            300\n removed                       0              0              0              0\n---------------------------------------------------------------------\nSUM:\n same                       2986              0         172604         966700\n modified                    251              0            112           1193\n added                         3            459            321           3901\n removed                       2             66             60            796\n---------------------------------------------------------------------\n\u003c/pre\u003e\nA pair of errors occurred.\nThe first pair was caused by timing out when computing diffs of the file\n`Python-X/Mac/Modules/qt/_Qtmodule.c` in each Python version.\nThis file has \u003e 26,000 lines of C code and takes more than\n10 seconds--the default maximum duration for diff'ing a\nsingle file--on my slow computer.  (Note:  this refers to\nperforming differences with\nthe `sdiff()` function in the Perl `Algorithm::Diff` module,\nnot the command line `diff` utility.)  This error can be\novercome by raising the time to, say, 20 seconds\nwith `--diff-timeout 20`.\n\nThe second error is more problematic.  The files\n`Python-X/Mac/Modules/qd/qdsupport.py`\ninclude Python docstring (text between pairs of triple quotes)\ncontaining C comments.  cloc treats docstrings as comments and handles them\nby first converting them to C comments, then using the C comment removing\nregular expression.  Nested C comments yield erroneous results however.\n\n[](1}}})\n\u003ca name=\"custom_lang\"\u003e\u003c/a\u003e []({{{1)\n##  [Create Custom Language Definitions \u0026#9650;](#___top \"click to go to top of document\")\ncloc can write its language comment definitions to a file or can read\ncomment definitions from a file, overriding the built-in definitions.\nThis can be useful when you want to use cloc to count lines of a\nlanguage not yet included, to change association of file extensions\nto languages, or to modify the way existing languages are counted.\n\nThe easiest way to create a custom language definition file is to\nmake cloc write its definitions to a file, then modify that file:\n\u003cpre\u003e\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cloc --write-lang-def=my_definitions.txt\n\u003c/pre\u003e\ncreates the file `my_definitions.txt` which can be modified\nthen read back in with either the `--read-lang-def` or\n`--force-lang-def` option.  The difference between the options is\nformer merges language definitions from the given file in with\ncloc's internal definitions with cloc's taking precedence\nif there are overlaps.  The `--force-lang-def` option, on the\nother hand, replaces cloc's definitions completely.\nThis option has a disadvantage in preventing cloc from counting\n\u003ca class=\"u\" href=\"#extcollision\" name=\"extcollision\"\u003e\nlanguages whose extensions map to multiple languages\n\u003c/a\u003e as these languages require additional logic that is not easily\nexpressed in a definitions file.\n\u003cpre\u003e\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cloc --read-lang-def=my_definitions.txt  \u003ci\u003efile1 file2 dir1 ...\u003c/i\u003e\n\u003c/pre\u003e\n\nEach language entry has four parts:\n* The language name starting in column 1.\n* One or more comment *filters* starting in column 5.\n* One or more filename extensions starting in column 5.\n* A 3rd generation scale factor starting in column 5.\n  This entry must be provided\n  but its value is not important\n  unless you want to compare your language to a hypothetical\n  third generation programming language.\n\nA filter defines a method to remove comment text from the source file.\nFor example the entry for C++ looks like this\n\u003cpre\u003eC++\n    filter call_regexp_common C++\n    filter remove_inline //.*$\n    extension C\n    extension c++\n    extension cc\n    extension cpp\n    extension cxx\n    extension pcc\n    3rd_gen_scale 1.51\n    end_of_line_continuation \\\\$\n\u003c/pre\u003e\nC++ has two filters:  first, remove lines matching\nRegexp::Common's C++ comment regex.\nThe second filter using remove_inline is currently\nunused.  Its intent is to identify lines with both\ncode and comments and it may be implemented in the future.\n\nA more complete discussion of the different filter options may appear\nhere in the future.  The output of cloc's\n`--write-lang-def` option should provide enough examples\nfor motivated individuals to modify or extend cloc's language definitions.\n\n[](1}}})\n\u003ca name=\"combine_reports\"\u003e\u003c/a\u003e []({{{1)\n##  [Combine Reports \u0026#9650;](#___top \"click to go to top of document\")\n\nIf you manage multiple software projects you might be interested in\nseeing line counts by project, not just by language.\nSay you manage three software projects called MariaDB, PostgreSQL, and SQLite.\nThe teams responsible for each of these projects run cloc on their\nsource code and provide you with the output.\nFor example, the MariaDB team does\n\n\u003cpre\u003ecloc --out mariadb-10.1.txt mariadb-server-10.1.zip\u003c/pre\u003e\n\nand provides you with the file `mariadb-10.1.txt`.\nThe contents of the three files you get are\n\n\u003cpre\u003e\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat mariadb-10.1.txt\nhttps://github.com/AlDanial/cloc v 1.65  T=45.36 s (110.5 files/s, 66411.4 lines/s)\n-----------------------------------------------------------------------------------\nLanguage                         files          blank        comment           code\n-----------------------------------------------------------------------------------\nC++                               1613         225338         290077         983026\nC                                  853          62442          73017         715018\nC/C++ Header                      1327          48300         114577         209394\nBourne Shell                       256          10224          10810          61943\nPerl                               147          10342           8305          35562\nPascal                             107           4907           5237          32541\nHTML                                56            195              6          16489\nJavascript                           5           3309           3019          15540\nm4                                  30           1599            359          14215\nCMake                              190           1919           4097          12206\nXML                                 35            648             56           5210\nRuby                                59            619            184           4998\nPuppet                              10              0              1           3848\nmake                               134            724            360           3631\nSQL                                 23            306            377           3405\nPython                              34            371            122           2545\nBourne Again Shell                  27            299            380           1604\nWindows Module Definition           37             27             13           1211\nlex                                  4            394            166            991\nyacc                                 2            152             64            810\nDOS Batch                           19             89             82            700\nProlog                               1              9             40            448\nRobotFramework                       1              0              0            441\nCSS                                  2             33            155            393\nJSON                                 5              0              0            359\ndtrace                               9             59            179            306\nWindows Resource File               10             61             89            250\nAssembly                             2             70            284            237\nWiX source                           1             18             10            155\nVisual Basic                         6              0              0             88\nYAML                                 2              4              4             65\nPHP                                  1             11              2             24\nSKILL                                1              8             15             16\nsed                                  2              0              0             16\nWindows Message File                 1              2              8              6\ndiff                                 1              1              4              4\nD                                    1              4             11              4\n-----------------------------------------------------------------------------------\nSUM:                              5014         372484         512110        2127699\n-----------------------------------------------------------------------------------\n\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat sqlite-3081101.txt\nhttps://github.com/AlDanial/cloc v 1.65  T=1.22 s (3.3 files/s, 143783.6 lines/s)\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nC                                2          11059          53924         101454\nC/C++ Header                     2            211           6630           1546\n-------------------------------------------------------------------------------\nSUM:                             4          11270          60554         103000\n-------------------------------------------------------------------------------\n\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat postgresql-9.4.4.txt\nhttps://github.com/AlDanial/cloc v 1.65  T=22.46 s (172.0 files/s, 96721.6 lines/s)\n-----------------------------------------------------------------------------------\nLanguage                         files          blank        comment           code\n-----------------------------------------------------------------------------------\nHTML                              1254           3725              0         785991\nC                                 1139         139289         244045         736519\nC/C++ Header                       667          12277          32488          57014\nSQL                                410          13400           8745          51926\nyacc                                 8           3163           2669          28491\nBourne Shell                        41           2647           2440          17170\nPerl                                81           1702           1308           9456\nlex                                  9            792           1631           4285\nmake                               205           1525           1554           4114\nm4                                  12            218             25           1642\nWindows Module Definition           13              4             17           1152\nXSLT                                 5             76             55            294\nDOS Batch                            7             29             30             92\nCSS                                  1             20              7             69\nAssembly                             3             17             38             69\nD                                    1             14             14             66\nWindows Resource File                3              4              0             62\nLisp                                 1              1              1             16\nsed                                  1              1              7             15\nPython                               1              5              0             13\nBourne Again Shell                   1              8              6             10\nWindows Message File                 1              0              0              5\n-----------------------------------------------------------------------------------\nSUM:                              3864         178917         295080        1698471\n-----------------------------------------------------------------------------------\n\u003c/pre\u003e\n\nWhile these three files are interesting, you also want to see\nthe combined counts from all projects.\nThat can be done with cloc's `--sum_reports`\noption:\n\n\u003cpre\u003e\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cloc --sum-reports --out=databases mariadb-10.1.txt  sqlite-3081101.txt  postgresql-9.4.4.txt\nWrote databases.lang\nWrote databases.file\n\u003c/pre\u003e\n\nThe report combination produces two output files, one for sums by\nprogramming language (`databases.lang`) and one by project\n(`databases.file`).\nTheir contents are\n\u003cpre\u003e\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat databases.lang\nhttps://github.com/AlDanial/cloc v 1.65\n--------------------------------------------------------------------------------\nLanguage                      files          blank        comment           code\n--------------------------------------------------------------------------------\nC                              1994         212790         370986        1552991\nC++                            1613         225338         290077         983026\nHTML                           1310           3920              6         802480\nC/C++ Header                   1996          60788         153695         267954\nBourne Shell                    297          12871          13250          79113\nSQL                             433          13706           9122          55331\nPerl                            228          12044           9613          45018\nPascal                          107           4907           5237          32541\nyacc                             10           3315           2733          29301\nm4                               42           1817            384          15857\nJavascript                        5           3309           3019          15540\nCMake                           190           1919           4097          12206\nmake                            339           2249           1914           7745\nlex                              13           1186           1797           5276\nXML                              35            648             56           5210\nRuby                             59            619            184           4998\nPuppet                           10              0              1           3848\nPython                           35            376            122           2558\nWindows Module Definition        50             31             30           2363\nBourne Again Shell               28            307            386           1614\nDOS Batch                        26            118            112            792\nCSS                               3             53            162            462\nProlog                            1              9             40            448\nRobotFramework                    1              0              0            441\nJSON                              5              0              0            359\nWindows Resource File            13             65             89            312\nAssembly                          5             87            322            306\ndtrace                            9             59            179            306\nXSLT                              5             76             55            294\nWiX source                        1             18             10            155\nVisual Basic                      6              0              0             88\nD                                 2             18             25             70\nYAML                              2              4              4             65\nsed                               3              1              7             31\nPHP                               1             11              2             24\nSKILL                             1              8             15             16\nLisp                              1              1              1             16\nWindows Message File              2              2              8             11\ndiff                              1              1              4              4\n--------------------------------------------------------------------------------\nSUM:                           8882         562671         867744        3929170\n--------------------------------------------------------------------------------\n\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat databases.file\n----------------------------------------------------------------------------------\nFile                            files          blank        comment           code\n----------------------------------------------------------------------------------\nmariadb-10.1.txt                 5014         372484         512110        2127699\npostgresql-9.4.4.txt             3864         178917         295080        1698471\nsqlite-3081101.txt                  4          11270          60554         103000\n----------------------------------------------------------------------------------\nSUM:                             8882         562671         867744        3929170\n----------------------------------------------------------------------------------\n\u003c/pre\u003e\n\nReport files themselves can be summed together.  Say you also manage\ndevelopment of Perl and Python and you want to keep track\nof those line counts separately from your database projects.  First\ncreate reports for Perl and Python separately:\n\n\u003cpre\u003e\ncloc --out perl-5.22.0.txt   perl-5.22.0.tar.gz\ncloc --out python-2.7.10.txt Python-2.7.10.tar.xz\n\u003c/pre\u003e\n\nthen sum these together with\n\n\u003cpre\u003e\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cloc --sum-reports --out script_lang perl-5.22.0.txt python-2.7.10.txt\nWrote script_lang.lang\nWrote script_lang.file\n\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat script_lang.lang\nhttps://github.com/AlDanial/cloc v 1.65\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nPerl                          2892         136396         184362         536445\nC                              680          75566          71211         531203\nPython                        2141          89642         109524         434015\nC/C++ Header                   408          16433          26938         214800\nBourne Shell                   154          11088          14496          87759\nMSBuild script                  77              0              3          38910\nm4                              20           1604            191          15559\nAssembly                        51           3775           6794          12298\nPascal                           8            458           1603           8592\nmake                            16            897            828           4939\nXML                             37            198              2           2484\nHTML                            14            393             11           2344\nC++                             12            338            295           2161\nWindows Module Definition        9            171            187           2081\nYAML                            49             20             15           2078\nProlog                          12            438              2           1146\nJSON                            14              1              0           1037\nyacc                             1             85             76            998\nDOS Batch                       44            199            148            895\nObjective-C                      7             98             61            635\nExpect                           6            104            161            565\nWindows Message File             1            102             11            489\nCSS                              1             98             19            328\nWindows Resource File            7             55             56            292\nJavascript                       3             31             49            229\nvim script                       1             36              7            106\ndiff                             1             17             87            105\nNAnt script                      2              1              0             30\nIDL                              1              0              0             24\nVisual Basic                     2              1              1             12\nD                                1              5              7              8\nLisp                             2              0              3              4\n-------------------------------------------------------------------------------\nSUM:                          6674         338250         417148        1902571\n-------------------------------------------------------------------------------\n\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat script_lang.file\n-------------------------------------------------------------------------------\nFile                         files          blank        comment           code\n-------------------------------------------------------------------------------\npython-2.7.10.txt             3240         161276         173214         998697\nperl-5.22.0.txt               3434         176974         243934         903874\n-------------------------------------------------------------------------------\nSUM:                          6674         338250         417148        1902571\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\nFinally, combine the combination files:\n\n\u003cpre\u003e\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cloc --sum-reports --report_file=everything databases.lang script_lang.lang\nWrote everything.lang\nWrote everything.file\n\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat everything.lang\nhttps://github.com/AlDanial/cloc v 1.65\n---------------------------------------------------------------------------------\nLanguage                       files          blank        comment           code\n---------------------------------------------------------------------------------\nC                               2674         288356         442197        2084194\nC++                             1625         225676         290372         985187\nHTML                            1324           4313             17         804824\nPerl                            3120         148440         193975         581463\nC/C++ Header                    2404          77221         180633         482754\nPython                          2176          90018         109646         436573\nBourne Shell                     451          23959          27746         166872\nSQL                              433          13706           9122          55331\nPascal                           115           5365           6840          41133\nMSBuild script                    77              0              3          38910\nm4                                62           3421            575          31416\nyacc                              11           3400           2809          30299\nJavascript                         8           3340           3068          15769\nmake                             355           3146           2742          12684\nAssembly                          56           3862           7116          12604\nCMake                            190           1919           4097          12206\nXML                               72            846             58           7694\nlex                               13           1186           1797           5276\nRuby                              59            619            184           4998\nWindows Module Definition         59            202            217           4444\nPuppet                            10              0              1           3848\nYAML                              51             24             19           2143\nDOS Batch                         70            317            260           1687\nBourne Again Shell                28            307            386           1614\nProlog                            13            447             42           1594\nJSON                              19              1              0           1396\nCSS                                4            151            181            790\nObjective-C                        7             98             61            635\nWindows Resource File             20            120            145            604\nExpect                             6            104            161            565\nWindows Message File               3            104             19            500\nRobotFramework                     1              0              0            441\ndtrace                             9             59            179            306\nXSLT                               5             76             55            294\nWiX source                         1             18             10            155\ndiff                               2             18             91            109\nvim script                         1             36              7            106\nVisual Basic                       8              1              1            100\nD                                  3             23             32             78\nsed                                3              1              7             31\nNAnt script                        2              1              0             30\nIDL                                1              0              0             24\nPHP                                1             11              2             24\nLisp                               3              1              4             20\nSKILL                              1              8             15             16\n---------------------------------------------------------------------------------\nSUM:                           15556         900921        1284892        5831741\n---------------------------------------------------------------------------------\n\n\u003ci\u003eUnix\u0026gt;\u003c/i\u003e cat everything.file\n-------------------------------------------------------------------------------\nFile                         files          blank        comment           code\n-------------------------------------------------------------------------------\ndatabases.lang                8882         562671         867744        3929170\nscript_lang.lang              6674         338250         417148        1902571\n-------------------------------------------------------------------------------\nSUM:                         15556         900921        1284892        5831741\n-------------------------------------------------------------------------------\n\u003c/pre\u003e\n\nOne limitation of the `--sum-reports` feature is that the individual counts must\nbe saved in the plain text format.  Counts saved as\nXML, JSON, YAML, or SQL will produce errors if used in a summation.\n\n[](1}}})\n\u003ca name=\"sql\"\u003e\u003c/a\u003e []({{{1)\n##  [SQL \u0026#9650;](#___top \"click to go to top of document\")\nCloc can write results in the form of SQL table create and insert\nstatements for use\nwith relational database programs such as SQLite, MySQL,\nPostgreSQL, Oracle, or Microsoft SQL.\nOnce the code count information is in a database,\nthe information can be interrogated and displayed in interesting ways.\n\nA database created from cloc SQL output has two tables,\n**metadata** and **t**:\n\nTable **metadata**:\n\n|Field     | Type                |\n|----------|---------------------|\n|id        | integer primary key |\n|timestamp | text                |\n|project   | text                |\n|elapsed_s | text                |\n\nTable **t**:\n\n|Field             | Type                     |\n|------------------|--------------------------|\n| project          |text                      |\n| language         |text                      |\n| file             |text                      |\n| nBlank           |integer                   |\n| nComment         |integer                   |\n| nCode            |integer                   |\n| nScaled          |real                      |\n| foreign key (id) | references metadata (id) |\n\nThe **metadata** table contains information about when the cloc run\nwas made.  Run time is stored two ways: as Unix epoch\nseconds in `id` and as an ISO 8601 formatted text string\nin the local time zone\n(for example `2024-03-01 14:19:41`) in `timestamp`.\nThe `--sql-append` switch allows one to combine\nmany runs in a single database; each run adds a\nrow to the metadata table.\nThe code count information resides in table **t**.\nThe `id` key makes it easy to associate a run's code count with\nits metadata.\n\nLet's repeat the code count examples of Perl, Python, SQLite, MySQL and\nPostgreSQL tarballs shown in the\n[Combine Reports](#combine_reports)\nexample above, this time\nusing the SQL output options and the\n[SQLite](http://www.sqlite.org/)\ndatabase engine.\n\nThe `--sql` switch tells cloc to generate output in the form\nof SQL table `create` and `insert` commands.  The switch takes\nan argument of a file name to write these SQL statements into, or,\nif the argument is 1 (numeric one), streams output to STDOUT.\nSince the SQLite command line program, `sqlite3`, can read\ncommands from STDIN, we can dispense with storing SQL statements to\na file and use `--sql 1` to pipe data directly into the\nSQLite executable:\n\n\u003cpre\u003e\ncloc --sql 1 --sql-project mariadb mariadb-server-10.1.zip | sqlite3 code.db\n\u003c/pre\u003e\n\nThe `--sql-project mariadb` part is optional; there's no need\nto specify a project name when working with just one code base.  However,\nsince we'll be adding code counts from four other tarballs, we'll only\nbe able to identify data by input source if we supply a\nproject name for each run.\n\nNow that we have a database we will need to pass in the `--sql-append`\nswitch to tell cloc not to wipe out this database but instead add more data:\n\n\u003cpre\u003e\ncloc --sql 1 --sql-project postgresql --sql-append postgresql-9.4.4.tar.bz2        | sqlite3 code.db\ncloc --sql 1 --sql-project sqlite     --sql-append sqlite-amalgamation-3081101.zip | sqlite3 code.db\ncloc --sql 1 --sql-project python     --sql-append Python-2.7.10.tar.xz            | sqlite3 code.db\ncloc --sql 1 --sql-project perl       --sql-append perl-5.22.0.tar.gz              | sqlite3 code.db\n\u003c/pre\u003e\n\nNow the fun begins--we have a database, `code.db`, with lots of\ninformation about the five projects and can query it\nfor all manner of interesting facts.\n\n**Which is the longest file over all projects?**\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project,file,nBlank+nComment+nCode as nL from t\n                                 where nL = (select max(nBlank+nComment+nCode) from t)'\n\nsqlite|sqlite-amalgamation-3081101/sqlite3.c|161623\n\u003c/pre\u003e\n\n`sqlite3`'s default output format leaves a bit to be desired.\nWe can add an option to the program's rc file,\n`~/.sqliterc`, to show column headers:\n\u003cpre\u003e\n  .header on\n\u003c/pre\u003e\nOne might be tempted to also include\n\u003cpre\u003e\n  .mode column\n\u003c/pre\u003e\nin `~/.sqliterc` but this causes problems when the output has more than\none row since the widths of entries in the first row govern the maximum\nwidth for all subsequent rows. Often this leads to truncated output--not\nat all desirable. One option is to write a custom SQLite output\nformatter such as `sqlite_formatter`, included with cloc.\n\nTo use it, simply pass `sqlite3`'s STDOUT into `sqlite_formatter`\nvia a pipe:\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project,file,nBlank+nComment+nCode as nL from t\n                         where nL = (select max(nBlank+nComment+nCode) from t)' | ./sqlite_formatter\n  \u003cfont color=\"darkgreen\"\u003e\n  -- Loading resources from ~/.sqliterc\n  Project File                                  nL\n  _______ _____________________________________ ______\n  sqlite  sqlite-amalgamation-3081101/sqlite3.c 161623\n  \u003c/font\u003e\n\u003c/pre\u003e\n\nIf the \"Project File\" line doesn't appear, add `.header on` to your\n`~/.sqliterc` file as explained above.\n\n\n**What is the longest file over all projects?**\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project,file,nBlank+nComment+nCode as nL from t\n                         where nL = (select max(nBlank+nComment+nCode) from t)' | sqlite_formatter\n\nProject File                                  nL\n_______ _____________________________________ ______\nsqlite  sqlite-amalgamation-3081101/sqlite3.c 161623\n\u003c/pre\u003e\n\n**What is the longest file in each project?**\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project,file,max(nBlank+nComment+nCode) as nL from t\n                          group by project order by nL;' | sqlite_formatter\n\nProject    File                                                             nL\n__________ ________________________________________________________________ ______\npython     Python-2.7.10/Mac/Modules/qt/_Qtmodule.c                          28091\npostgresql postgresql-9.4.4/src/interfaces/ecpg/preproc/preproc.c            54623\nmariadb    server-10.1/storage/mroonga/vendor/groonga/lib/nfkc.c             80246\nperl       perl-5.22.0/cpan/Locale-Codes/lib/Locale/Codes/Language_Codes.pm 100747\nsqlite     sqlite-amalgamation-3081101/sqlite3.c                            161623\n\u003c/pre\u003e\n\n**Which files in each project have the most code lines?**\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project,file,max(nCode) as nL from t\n                         group by project order by nL desc;' | sqlite_formatter\n\nProject    File                                                             nL\n__________ ________________________________________________________________ ______\nperl       perl-5.22.0/cpan/Locale-Codes/lib/Locale/Codes/Language_Codes.pm 100735\nsqlite     sqlite-amalgamation-3081101/sqlite3.c                             97469\nmariadb    server-10.1/storage/mroonga/vendor/groonga/lib/nfkc.c             80221\npostgresql postgresql-9.4.4/src/interfaces/ecpg/preproc/preproc.c            45297\npython     Python-2.7.10/Mac/Modules/qt/_Qtmodule.c                          26705\n\u003c/pre\u003e\n\n**Which C source files with more than 300 lines have a comment ratio below 1%?**\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project, file, nCode, nComment,\n                         (100.0*nComment)/(nComment+nCode) as comment_ratio from t\n                         where language=\"C\" and nCode \u003e 300 and\n                         comment_ratio \u003c 1 order by comment_ratio;' | sqlite_formatter\n\nProject    File                                                                                            nCode nComment comment_ratio\n__________ _______________________________________________________________________________________________ _____ ________ __________________\nmariadb    server-10.1/storage/mroonga/vendor/groonga/lib/nfkc.c                                           80221       14 0.0174487443135789\npython     Python-2.7.10/Python/graminit.c                                                                  2175        1 0.0459558823529412\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_turkish.c                            2095        1 0.0477099236641221\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_french.c                             1211        1 0.0825082508250825\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c                        1201        1 0.0831946755407654\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_hungarian.c                          1182        1 0.084530853761623\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_hungarian.c                     1178        1 0.0848176420695505\nmariadb    server-10.1/strings/ctype-eucjpms.c                                                             67466       60 0.0888546633889169\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_english.c                            1072        1 0.0931966449207828\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c                       1064        1 0.0938967136150235\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_spanish.c                            1053        1 0.094876660341556\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_spanish.c                       1049        1 0.0952380952380952\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_italian.c                            1031        1 0.0968992248062016\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c                       1023        1 0.09765625\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_portuguese.c                          981        1 0.10183299389002\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c                     975        1 0.102459016393443\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_romanian.c                            967        1 0.103305785123967\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_2_romanian.c                       961        1 0.103950103950104\nmariadb    server-10.1/strings/ctype-ujis.c                                                                67177       79 0.117461639110265\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_finnish.c                             720        1 0.13869625520111\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_porter.c                              717        1 0.139275766016713\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c                        714        1 0.13986013986014\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c                         711        1 0.140449438202247\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_KOI8_R_russian.c                            660        1 0.151285930408472\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_russian.c                             654        1 0.152671755725191\npython     Python-2.7.10/Mac/Modules/qt/_Qtmodule.c                                                        26705       42 0.157026956294164\npython     Python-2.7.10/Mac/Modules/icn/_Icnmodule.c                                                       1521        3 0.196850393700787\nmariadb    server-10.1/strings/ctype-extra.c                                                                8282       18 0.216867469879518\npostgresql postgresql-9.4.4/src/bin/psql/sql_help.c                                                         3576        8 0.223214285714286\nmariadb    server-10.1/strings/ctype-sjis.c                                                                34006       86 0.252258594391646\npython     Python-2.7.10/Python/Python-ast.c                                                                6554       17 0.258712524729874\nmariadb    server-10.1/strings/ctype-cp932.c                                                               34609       92 0.265122042592432\nperl       perl-5.22.0/keywords.c                                                                           2815        8 0.283386468296139\npython     Python-2.7.10/Mac/Modules/menu/_Menumodule.c                                                     3263       10 0.305530094714329\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_dutch.c                               596        2 0.334448160535117\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c                          586        2 0.340136054421769\nmariadb    server-10.1/strings/ctype-gbk.c                                                                 10684       38 0.354411490393583\npython     Python-2.7.10/Mac/Modules/qd/_Qdmodule.c                                                         6694       24 0.357249181303959\npython     Python-2.7.10/Mac/Modules/win/_Winmodule.c                                                       3056       11 0.358656667753505\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_german.c                              476        2 0.418410041841004\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c                         470        2 0.423728813559322\nmariadb    server-10.1/strings/ctype-euc_kr.c                                                               9956       44 0.44\npostgresql postgresql-9.4.4/src/backend/utils/fmgrtab.c                                                     4815       23 0.475403059115337\npython     Python-2.7.10/Mac/Modules/ctl/_Ctlmodule.c                                                       5442       28 0.511882998171846\npython     Python-2.7.10/Mac/Modules/ae/_AEmodule.c                                                         1347        7 0.51698670605613\npython     Python-2.7.10/Mac/Modules/app/_Appmodule.c                                                       1712        9 0.52295177222545\nmariadb    server-10.1/strings/ctype-gb2312.c                                                               6377       35 0.54585152838428\nmariadb    server-10.1/storage/tokudb/ft-index/third_party/xz-4.999.9beta/src/liblzma/lzma/fastpos_table.c   516        3 0.578034682080925\npython     Python-2.7.10/Mac/Modules/evt/_Evtmodule.c                                                        504        3 0.591715976331361\npython     Python-2.7.10/Modules/expat/xmlrole.c                                                            1256        8 0.632911392405063\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_UTF_8_danish.c                              312        2 0.636942675159236\npostgresql postgresql-9.4.4/src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c                         310        2 0.641025641025641\npython     Python-2.7.10/Mac/Modules/res/_Resmodule.c                                                       1621       12 0.734843845682792\npython     Python-2.7.10/Mac/Modules/drag/_Dragmodule.c                                                     1046        8 0.759013282732448\npython     Python-2.7.10/Mac/Modules/list/_Listmodule.c                                                     1021        8 0.777453838678329\npython     Python-2.7.10/Mac/Modules/te/_TEmodule.c                                                         1198       10 0.827814569536424\npython     Python-2.7.10/Mac/Modules/cg/_CGmodule.c                                                         1190       10 0.833333333333333\npython     Python-2.7.10/Modules/clmodule.c                                                                 2379       23 0.957535387177352\npython     Python-2.7.10/Mac/Modules/folder/_Foldermodule.c                                                  306        3 0.970873786407767\n\u003c/pre\u003e\n\n**What are the ten longest files (based on code lines) that have no comments at all?  Exclude header, .html, and YAML files.**\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project, file, nCode from t\n                         where nComment = 0 and\n                         language not in (\"C/C++ Header\", \"YAML\", \"HTML\")\n                         order by nCode desc limit 10;' | sqlite_formatter\n\nProject File                                                                 nCode\n_______ ____________________________________________________________________ _____\nperl    perl-5.22.0/cpan/Unicode-Collate/Collate/Locale/ja.pl                 1938\npython  Python-2.7.10/PCbuild/pythoncore.vcproj                               1889\npython  Python-2.7.10/PC/VS8.0/pythoncore.vcproj                              1889\nmariadb server-10.1/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc  1862\nperl    perl-5.22.0/cpan/Unicode-Collate/Collate/Locale/zh_strk.pl            1589\nperl    perl-5.22.0/cpan/Unicode-Collate/Collate/Locale/zh_zhu.pl             1563\nmariadb server-10.1/storage/mroonga/vendor/groonga/configure.ac               1526\nperl    perl-5.22.0/cpan/Unicode-Collate/Collate/Locale/zh_pin.pl             1505\nmariadb server-10.1/mysql-test/suite/funcs_1/storedproc/storedproc_02.inc     1465\npython  Python-2.7.10/PC/VS8.0/_bsddb.vcproj                                  1463\n\u003c/pre\u003e\n\n**What are the most popular languages (in terms of lines\nof code) in each project?**\n\n\u003cpre\u003e\nprompt\u003e sqlite3 code.db 'select project, language, sum(nCode) as SumCode from t\n                         group by project,language\n                         order by project,SumCode desc;' | sqlite_formatter\nProject    Language                  SumCode\n__________ _________________________ _______\nmariadb    C++                        983026\nmariadb    C                          715018\nmariadb    C/C++ Header               209394\nmariadb    Bourne Shell                61943\nmariadb    Perl                        35562\nmariadb    Pascal                      32541\nmariadb    HTML                        16489\nmariadb    Javascript                  15540\nmariadb    m4                          14215\nmariadb    CMake                       12206\nmariadb    XML                          5210\nmariadb    Ruby                         4998\nmariadb    Puppet                       3848\nmariadb    make                         3631\nmariadb    SQL                          3405\nmariadb    Python                       2545\nmariadb    Bourne Again Shell           1604\nmariadb    Windows Module Definition    1211\nmariadb    lex                           991\nmariadb    yacc                          810\nmariadb    DOS Batch                     700\nmariadb    Prolog                        448\nmariadb    RobotFramework                441\nmariadb    CSS                           393\nmariadb    JSON                          359\nmariadb    dtrace                        306\nmariadb    Windows Resource File         250\nmariadb    Assembly                      237\nmariadb    WiX source                    155\nmariadb    Visual Basic                   88\nmariadb    YAML                           65\nmariadb    PHP                            24\nmariadb    SKILL                          16\nmariadb    sed                            16\nmariadb    Windows Message File            6\nmariadb    D                               4\nmariadb    diff                            4\nperl       Perl                       536445\nperl       C                          155648\nperl       C/C++ Header               147858\nperl       Bourne Shell                42668\nperl       Pascal                       8592\nperl       XML                          2410\nperl       YAML                         2078\nperl       C++                          2033\nperl       make                         1986\nperl       Prolog                       1146\nperl       JSON                         1037\nperl       yacc                          998\nperl       Windows Message File          489\nperl       DOS Batch                     389\nperl       Windows Resource File          85\nperl       D                               8\nperl       Lisp                            4\npostgresql HTML                       785991\npostgresql C                          736519\npostgresql C/C++ Header                57014\npostgresql SQL                         51926\npostgresql yacc                        28491\npostgresql Bourne Shell                17170\npostgresql Perl                         9456\npostgresql lex                          4285\npostgresql make                         4114\npostgresql m4                           1642\npostgresql Windows Module Definition    1152\npostgresql XSLT                          294\npostgresql DOS Batch                      92\npostgresql Assembly                       69\npostgresql CSS                            69\npostgresql D                              66\npostgresql Windows Resource File          62\npostgresql Lisp                           16\npostgresql sed                            15\npostgresql Python                         13\npostgresql Bourne Again Shell             10\npostgresql Windows Message File            5\npython     Python                     434015\npython     C                          375555\npython     C/C++ Header                66942\npython     Bourne Shell                45091\npython     MSBuild script              38910\npython     m4                          15559\npython     Assembly                    12298\npython     make                         2953\npython     HTML                         2344\npython     Windows Module Definition    2081\npython     Objective-C                   635\npython     Expect                        565\npython     DOS Batch                     506\npython     CSS                           328\npython     Javascript                    229\npython     Windows Resource File         207\npython     C++                           128\npython     vim script                    106\npython     diff                          105\npython     XML                            74\npython     NAnt script                    30\npython     Prolog                         24\npython     Visual Basic                   12\nsqlite     C                          101454\nsqlite     C/C++ Header                 1546\n\u003c/pre\u003e\n\n[](1}}})\n\u003ca name=\"custom_column_output\"\u003e\u003c/a\u003e []({{{1)\n##  [Custom Column Output \u0026#9650;](#___top \"click to go to top of document\")\nCloc's default output is a text table with five columns:\nlanguage, file count, number of blank lines, number of comment\nlines and number of code lines.  The switches `--by-file`,\n`--3`, and `--by-percent` generate additional information but\nsometimes even those are insufficient.\n\nThe `--sql` option described in the previous section offers the\nability to create custom output.  This section has a pair of examples\nthat show how to create custom columns.\nThe first example includes an extra column, **Total**, which is the\nsum of the numbers of blank, comment, and code lines.\nThe second shows how to include the language name when running\nwith `--by-file`.\n\n**Example 1:  Add a \"Totals\" column.**\n\nThe first step is to run cloc and save the output to a relational database,\nSQLite in this case:\n\u003cpre\u003e\ncloc --sql 1 --sql-project x yaml-cpp-yaml-cpp-0.5.3.tar.gz | sqlite3 counts.db\n\u003c/pre\u003e\n(the tar file comes from the\n[YAML-C++](https://github.com/jbeder/yaml-cpp) project).\n\nSecond, we craft an SQL query that returns the regular cloc output\nplus an extra column for totals, then save the SQL statement to\na file, `query_with_totals.sql`:\n\u003cpre\u003e\n-- file query_with_totals.sql\nselect Language, count(File)   as files                       ,\n                 sum(nBlank)   as blank                       ,\n                 sum(nComment) as comment                     ,\n                 sum(nCode)    as code                        ,\n                 sum(nBlank)+sum(nComment)+sum(nCode) as Total\n    from t group by Language order by code desc;\n\u003c/pre\u003e\n\nThird, we run this query through SQLite using the `counts.db` database.\nWe'll include the `-header` switch so that SQLite prints the\ncolumn names:\n\n\u003cpre\u003e\n\u0026gt; cat query_with_totals.sql | sqlite3 -header counts.db\nLanguage|files|blank|comment|code|Total\nC++|141|12786|17359|60378|90523\nC/C++ Header|110|8566|17420|51502|77488\nBourne Shell|10|6351|6779|38264|51394\nm4|11|2037|260|17980|20277\nPython|30|1613|2486|4602|8701\nMSBuild script|11|0|0|1711|1711\nCMake|7|155|285|606|1046\nmake|5|127|173|464|764\nMarkdown|2|30|0|39|69\n\u003c/pre\u003e\n\nThe extra column for **Total** is there but the format is unappealing.\nRunning the output through `sqlite_formatter` yields the desired result:\n\n\u003cpre\u003e\n\u0026gt; cat query_with_totals.sql | sqlite3 -header counts.db | sqlite_formatter\nLanguage       files blank comment code  Total\n______________ _____ _____ _______ _____ _____\nC++              141 12786   17359 60378 90523\nC/C++ Header     110  8566   17420 51502 77488\nBourne Shell      10  6351    6779 38264 51394\nm4                11  2037     260 17980 20277\nPython            30  1613    2486  4602  8701\nMSBuild script    11     0       0  1711  1711\nCMake              7   155     285   606  1046\nmake               5   127     173   464   764\nMarkdown           2    30       0    39    69\n\u003c/pre\u003e\n\nThe next section,\n[Wrapping cloc in other scripts](#wrapping-cloc-in-other-scripts-),\nshows one way these commands can be combined\ninto a new utility program.\n\n**Example 2:  Include a column for \"Language\" when running with `--by-file`.**\n\nOutput from `--by-file` omits each file's language to save screen real estate;\nfile paths for large projects can be long and including an extra 20 or so\ncharacters for a Language column can be excessive.\n\nAs an example, here are the first few lines of output using the same\ncode base as in Example 1:\n\n\u003cpre\u003e\n\u0026gt; cloc --by-file yaml-cpp-yaml-cpp-0.5.3.tar.gz\ngithub.com/AlDanial/cloc v 1.81  T=1.14 s (287.9 files/s, 221854.9 lines/s)\n--------------------------------------------------------------------------------------------------------------------------------------------\nFile                                                                                                     blank        comment           code\n--------------------------------------------------------------------------------------------------------------------------------------------\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/configure                                                        2580           2264          13691\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/configure                                                  2541           2235          13446\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/fused-src/gtest/gtest.h                                    1972           4681          13408\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/fused-src/gmock/gmock.h                                          1585           3397           9216\nyaml-cpp-yaml-cpp-0.5.3/test/integration/gen_emitter_test.cpp                                              999              0           8760\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/aclocal.m4                                                        987            100           8712\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/m4/libtool.m4                                               760             65           7176\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/build-aux/ltmain.sh                                         959           1533           7169\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/fused-src/gmock-gtest-all.cc                                     1514           3539           6390\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/fused-src/gtest/gtest-all.cc                               1312           2896           5384\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/test/gtest_unittest.cc                                     1226           1091           5098\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/include/gtest/internal/gtest-param-util-generated.h         349            235           4559\n\u003c/pre\u003e\n\nThe absence of language identification for each file\nis a bit disappointing, but\nthis can be remedied with a custom column solution.\n\nThe first step, creating a database, matches that from Example 1 so\nwe'll go straight to the second step of creating the desired\nSQL query.  We'll store this one in the file `by_file_with_language.sql`:\n\n\u003cpre\u003e\n-- file by_file_with_language.sql\nselect File, Language, nBlank   as blank  ,\n                       nComment as comment,\n                       nCode    as code\n    from t order by code desc;\n\u003c/pre\u003e\n\nOur desired extra column appears when we pass this custom SQL query\nthrough our database:\n\n\u003cpre\u003e\n\u0026gt; cat by_file_with_language.sql | sqlite3 -header counts.db | sqlite_formatter\nFile                                                                                               Language       blank comment code\n__________________________________________________________________________________________________ ______________ _____ _______ _____\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/configure                                                 Bourne Shell    2580    2264 13691\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/configure                                           Bourne Shell    2541    2235 13446\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/fused-src/gtest/gtest.h                             C/C++ Header    1972    4681 13408\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/fused-src/gmock/gmock.h                                   C/C++ Header    1585    3397  9216\nyaml-cpp-yaml-cpp-0.5.3/test/integration/gen_emitter_test.cpp                                      C++              999       0  8760\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/aclocal.m4                                                m4               987     100  8712\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/m4/libtool.m4                                       m4               760      65  7176\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/build-aux/ltmain.sh                                 Bourne Shell     959    1533  7169\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/fused-src/gmock-gtest-all.cc                              C++             1514    3539  6390\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/fused-src/gtest/gtest-all.cc                        C++             1312    2896  5384\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/test/gtest_unittest.cc                              C++             1226    1091  5098\nyaml-cpp-yaml-cpp-0.5.3/test/gmock-1.7.0/gtest/include/gtest/internal/gtest-param-util-generated.h C/C++ Header     349     235  4559\n\u003c/pre\u003e\n\n[](1}}})\n\u003ca name=\"wrapping_cloc_in_other_scripts\"\u003e\u003c/a\u003e []({{{1)\n    *   [](#wrapping-cloc-in-other-scripts-)\n##  [Wrapping cloc in other scripts \u0026#9650;](#___top \"click to go to top of document\")\n\nMore complex code counting solutions are possible by wrapping\ncloc in scripts or programs.  The \"total lines\" column from\nexample 1 of [Custom Column Output](#custom-column-output-)\ncould be simplified to a single command with this shell script (on Linux):\n\n\u003cpre\u003e\n#!/bin/sh\n#\n# These commands must be in the user's $PATH:\n#   cloc\n#   sqlite3\n#   sqlite_formatter\n#\nif test $# -eq 0 ; then\n    echo \"Usage: $0  [cloc arguments]\"\n    echo \"       Run cloc to count lines of code with an additional\"\n    echo \"       output column for total lines (code+comment+blank).\"\n    exit\nfi\nDBFILE=`tempfile`\ncloc --sql 1 --sql-project x $@ | sqlite3 ${DBFILE}\nSQL=\"select Language, count(File)   as files                       ,\n                      sum(nBlank)   as blank                       ,\n                      sum(nComment) as comment                     ,\n                      sum(nCode)    as code                        ,\n                      sum(nBlank)+sum(nComment)+sum(nCode) as Total\n         from t group by Language order by code desc;\n\"\necho ${SQL} | sqlite3 -header ${DBFILE} | sqlite_formatter\nrm ${DBFILE}\n\u003c/pre\u003e\n\nSaving the lines above to ``total_columns.sh`` and making it\nexecutable (``chmod +x total_columns.sh``) would let us do\n\u003cpre\u003e\n./total_columns.sh yaml-cpp-yaml-cpp-0.5.3.tar.gz\n\u003c/pre\u003e\nto directly get\n\u003cpre\u003e\nLanguage       files blank comment code  Total\n______________ _____ _____ _______ _____ _____\nC++              141 12786   17359 60378 90523\nC/C++ Header     110  8566   17420 51502 77488\nBourne Shell      10  6351    6779 38264 51394\nm4                11  2037     260 17980 20277\nPython            30  1613    2486  4602  8701\nMSBuild script    11     0       0  1711  1711\nCMake              7   155     285   606  1046\nmake               5   127     173   464   764\nMarkdown           2    30       0    39    69\n\u003c/pre\u003e\n\nOther examples:\n* Count code from a specific branch of a web-hosted\ngit repository and send the results as a .csv email attachment:\nhttps://github.com/dannyloweatx/checkmarx\n\n\n[](1}}})\n\u003ca name=\"git_and_UTF8_pathnames\"\u003e\u003c/a\u003e []({{{1)\n##  [git and UTF8 pathnames \u0026#9650;](#___top \"click to go to top of document\")\n\ncloc's ``--git`` option may fail if you work with directory or\nfile names with UTF-8 characters (for example, see\n\u003ca href=https://github.com/AlDanial/cloc/issues/457\u003eissue 457\u003c/a\u003e).\nThe solution,\nhttps://stackoverflow.com/questions/22827239/how-to-make-git-properly-display-utf-8-encoded-pathnames-in-the-console-window,\nis to apply this git configuration command:\n\n\u003cpre\u003e\ngit config --global core.quotepath off\n\u003c/pre\u003e\n\nYour console's font will need to be capable of displaying\nUnicode characters.\n\n[](1}}})\n\u003ca name=\"scale_factors\"\u003e\u003c/a\u003e []({{{1)\n##  [Third Generation Language Scale Factors \u0026#9650;](#___top \"click to go to top of document\")\n\ncloc versions before 1.50 by default computed, for the provided inputs, a\nrough estimate of how many lines of code would be needed to write the\nsame code in a hypothetical third-generation computer language.\nTo produce this output one must now use the `--3` switch.\n\nScale factors were derived from the 2006 version of language gearing ratios\nlisted at Mayes Consulting web site,\n[http://softwareestimator.com/IndustryData2.htm](http://softwareestimator.com/IndustryData2.htm), using this equation:\n\ncloc scale factor for language X = 3rd generation default gearing ratio / language X gearing ratio\n\nFor example, cloc 3rd generation scale factor for DOS Batch = 80 / 128 = 0.625.\n\nThe biggest flaw with this approach is that gearing ratios are defined\nfor logical lines of source code not physical lines (which cloc counts).\nThe values in cloc's 'scale' and '3rd gen. equiv.' columns should be\ntaken with a large grain of salt.\n\n[](1}}})\n\u003ca name=\"options_txt\"\u003e\u003c/a\u003e []({{{1)\n##  [options.txt configuration file \u0026#9650;](#___top \"click to go to top of document\")\n\nIf you find yourself using the same command line switches every\ntime you invoke cloc, you can save some typing by adding those\nswitches to the ``options.txt`` runtime configuration file.\ncloc will look for this file in the following default locations:\n\u003cpre\u003e\n# Linux, NetBSD, FreeBSD, macOS:\n/home/USERNAME/.config/cloc/options.txt\n\n# Windows\nC:\\Users\\USERNAME\\AppData\\Roaming\\cloc\n\u003c/pre\u003e\n\nIf you run cloc with ``--help``, cloc will tell you\nwhere it expects to find this config file file.  The information\nappears by the explanation of the ``--config`` switch after\nthe text ``the default location of``.\nOn Unix-like operating systems, this can be simplified to\n\n\u003cpre\u003e\n\u0026gt; cloc --help | grep \"default location\"\n             the default location of /home/al/.config/cloc/options.txt.\n\u003c/pre\u003e\n\nand in a Windows ``cmd`` terminal with\n\n\u003cpre\u003e\n\u0026gt; cloc --help | findstr default | findstr location\n             the default location of C:\\Users\\al\\AppData\\Roaming\\cloc\n\u003c/pre\u003e\n\nPlace each switch and arguments, if any, on a line by itself.\nLines prefixed with ``#`` symbol are ignored as comments and\nblank lines are skipped.  Leading hyphens on the switches are\noptional.  Here's a sample file:\n\u003cpre\u003e\n# options.txt\n--vcs git\nv      # verbose level 1\nexclude-ext svg,html\n\u003c/pre\u003e\n\nThe path to the ``options.txt`` file can also be specified\nwith the ``--config FILE`` switch.\n\nFinally, if cloc finds an ``options.txt`` file in the same\ndirectory as files given by any of these switches (in the\nlisted priority), it will use that configuration file\nfrom that location:\n\n1. ``--list-file``\n1. ``--exclude-list-file``\n1. ``--read-lang-def``\n1. ``--force-lang-def``\n1. ``--diff-list-file``\n\nRun with ``--verbose`` to have cloc tell you which, if\nany, ``options.txt`` file it uses.\n\n[](1}}})\n\u003ca name=\"Java Programmatic Interface\"\u003e\u003c/a\u003e []({{{1)\n##  [Java Programmatic Interface \u0026#9650;](#___top \"click to go to top of document\")\n\n[Ozren Dabić](https://github.com/seart-group/jcloc/commits?author=dabico)\ncreated a Java programmatic interface to cloc.\nIt is available at https://github.com/seart-group/jcloc\n\n[](1}}})\n\u003ca name=\"complex_regex_recursion\"\u003e\u003c/a\u003e []({{{1)\n#  [Complex regular subexpression recursion limit \u0026#9650;](#___top \"click to go to top of document\")\ncloc relies on the Regexp::Common module's regular expressions to remove\ncomments from source code.  If comments are malformed, for example the\n``/*`` start comment marker appears in a C program without a corresponding ``*/``\nmarker, the regular expression engine could enter a recursive\nloop, eventually triggering the warning\n``Complex regular subexpression recursion limit``.\n\nThe most common cause for this warning is the existence of comment markers\nin string literals.  While language compilers and interpreters are smart\nenough to recognize that ``\"/*\"`` (for example) is a string and not a comment,\ncloc is fooled.  File path globs, as in this line of JavaScript\n\u003cpre\u003evar paths = globArray(\"**/*.js\", {cwd: srcPath});\n\u003c/pre\u003e\nare frequent culprits.\n\nIn an attempt to overcome this problem, a different\nalgorithm which removes comment markers in strings can be enabled\nwith the ``--strip-str-comments`` switch.  Doing so, however,\nhas drawbacks:  cloc\nwill run more slowly and the output of ``--strip-comments``\nwill contain strings that no longer match the input source.\n\n[](1}}})\n\u003ca name=\"Limitations\"\u003e\u003c/a\u003e []({{{1)\n#   [Limitations \u0026#9650;](#___top \"click to go to top of document\")\nIdentifying comments within source code is trickier than one might expect.\nMany languages would need a complete parser to be counted correctly.\ncloc does not attempt to parse any of\nthe languages it aims to count and therefore is an imperfect tool.\nThe following are known problems:\n\n\u003col\u003e\n\u003cli\u003e  Lines containing both source code and comments are counted as lines of code.\n\u003c/li\u003e\n\u003cli\u003e  Comment markers within strings or\n\u003ca href=\"http://www.faqs.org/docs/abs/HTML/here-docs.html\"\u003ehere-documents\u003c/a\u003e\nare treated as actual comment markers and not string literals.\nFor example the following lines of C code\n\u003cpre\u003eprintf(\" /* \");\nfor (i = 0; i \u003c 100; i++) {\n    a += i;\n}\nprintf(\" */ \");\n\u003c/pre\u003e\nlook to cloc like this:\n\u003cpre\u003eprintf(\" xxxxxxx\nxxxxxxx\nxxxxxxx\nxxxxxxx\nxxxxxxx     \");\n\u003c/pre\u003e\nwhere \u003ctt\u003exxxxxxx\u003c/tt\u003e represents cloc's view of commented text.\nTherefore cloc counts the five lines as two lines of C code and three\nlines of comments (lines with both code and comment are counted as code).\n\nIf you suspect your code has such strings, use the switch\n``--strip-str-comments`` to switch to the algorithm which removes\nembedded comment markers.  Its use will render the five lines above as\n\u003cpre\u003eprintf(\"  \");\nfor (i = 0; i \u003c 100; i++) {\n    a += i;\n}\nprintf(\"  \");\n\u003c/pre\u003e\nand therefore return a count of five lines of code.\nSee the\n[previous section](#complex-regular-subexpression-recursion-limit-)\non drawbacks to using ``--strip-str-comments``.\n\u003c/li\u003e\n\u003cli\u003e Embedded languages are not recognized.  For example, an HTML file containing\nJavaScript will be counted entirely as HTML.\n\u003c/li\u003e\n\u003cli\u003e Python docstrings can serve several purposes.  They may\ncontain documentation,\ncomment out blocks of code, or they can be regular strings (when\nthey appear on the right hand side of an assignment or as a function argument).\ncloc is unable to infer the meaning of docstrings by context; by default\ncloc treats all docstrings as comments.  The switch\n\u003ctt\u003e--docstring-as-code\u003c/tt\u003e\ntreats all docstrings as code.\n\u003c/li\u003e\n\u003cli\u003e Language definition files read with \u003ctt\u003e--read-lang-def\u003c/tt\u003e or\n\u003ctt\u003e--force-lang-def\u003c/tt\u003e must be plain ASCII text files.\n\u003c/li\u003e\n\u003cli\u003e cloc treats compiler pragma's, for example \u003ctt\u003e#if\u003c/tt\u003e / \u003ctt\u003e#endif\u003c/tt\u003e, as code\neven if these are used to block lines of source from being compiled;\nthe blocked lines still contribute to the code count.\n\u003c/li\u003e\n\u003cli\u003e On Windows, cloc  will fail with \u003ctt\u003eCan't cd to ... No such file or\ndirectory at \u003cembedded\u003e/File/Find.pm\u003c/tt\u003e if the code being scanned has\nfile paths longer than 255 characters.  A work-around is to run cloc\nfrom the Windows Subsystem for Linux (WSL).\n\u003c/li\u003e\n\u003cli\u003e cloc's comment match code uses regular expressions\nwhich cannot properly account for nested comments using\nthe same comment markers (such as \u003ctt\u003e/*  /*  */  */\u003c/tt\u003e).\n\u003c/li\u003e\n\u003cli\u003e XML comments embedded within \u003ctt\u003eCDATA\u003c/tt\u003e blocks are counted as\ncomments rather than code.\n\u003c/li\u003e\n\u003c/ol\u003e\n\n[](1}}})\n\u003ca name=\"AdditionalLanguages\"\u003e\u003c/a\u003e []({{{1)\n#   [Requesting Support for Additional Languages \u0026#9650;](#___top \"click to go to top of document\")\n\nIf cloc does not recognize a language you are interested in counting,\ncreate a [GitHub issue](https://github.com/AlDanial/cloc/issues)\nrequesting support for your language.  Include this information:\n\u003col\u003e\n\u003cli\u003e File extensions associated with the language.  If the language does\nnot rely on file extensions and instead works with fixed file names or\nwith `#!` style program invocations, explain what those are.\u003c/li\u003e\n\u003cli\u003e A description of how comments are defined.\u003c/li\u003e\n\u003cli\u003e Links to sample code.\u003c/li\u003e\n\u003c/ol\u003e\n\n[](1}}})\n\u003ca name=\"reporting_problems\"\u003e\u003c/a\u003e []({{{1)\n#  [Reporting Problems \u0026#9650;](#___top \"click to go to top of document\")\n\nIf you encounter a problem with cloc, first check to see if\nyou're running with the latest version of the tool:\n\u003cpre\u003e\n  cloc --version\n\u003c/pre\u003e\nIf the version is older than the most recent release\nat https://github.com/AlDanial/cloc/releases, download the\nlatest version and see if it solves your problem.\n\nIf the problem happens with the latest release, submit\na new issue at https://github.com/AlDanial/cloc/issues *only*\nif you can supply enough information for anyone reading the\nissue report to reproduce the problem.\nThat means providing\n\u003col\u003e\n\u003cli\u003e the operating system you're running on\u003c/li\u003e\n\u003cli\u003e the cloc command with all options\u003c/li\u003e\n\u003cli\u003e the code you are counting (URL to a public git repo or zip file or\ntar file, et cetera)\u003c/li\u003e\n\u003c/ol\u003e\nThe last item is generally problematic.  If the code base is\nproprietary or amounts to more than a few dozen kilobytes,\nyou'll need to try to reconstruct similar inputs or demonstrate\nthe problem with an existing public code base.\n\nProblem reports that cannot be reproduced will be ignored and\neventually closed.\n\n[](1}}})\n\u003ca name=\"citation\"\u003e\u003c/a\u003e []({{{1)\n#  [Citation \u0026#9650;](#___top \"click to go to top of document\")\n\nPlease use the following bibtex entry to cite cloc in a publication:\n\n\u003cpre\u003e\n@software{adanial_cloc,\n  author       = {Albert Danial},\n  title        = {cloc: v1.92},\n  month        = dec,\n  year         = 2021,\n  publisher    = {Zenodo},\n  version      = {v1.92},\n  doi          = {10.5281/zenodo.5760077},\n  url          = {https://doi.org/10.5281/zenodo.5760077}\n}\n\u003c/pre\u003e\n\n(Update the version number and corresponding year if this\nentry is outdated.)\n\n[](1}}})\n\u003ca name=\"Acknowledgments\"\u003e\u003c/a\u003e []({{{1)\n#   [Acknowledgments \u0026#9650;](#___top \"click to go to top of document\")\n[Wolfram Rösler](https://github.com/wolframroesler) provided most of the code examples in the test suite.\nThese examples come from his [Hello World collection](http://helloworldcollection.de/).\n\nIsmet Kursunoglu found errors with the MUMPS counter and provided\naccess to a computer with a large body of MUMPS code to test cloc.\n\nTod Huggins gave helpful suggestions for the Visual Basic filters.\n\nAnton Demichev found a flaw with the JSP counter in cloc v0.76\nand wrote the XML output generator for the `--xml` option.\n\nReuben Thomas pointed out that ISO C99 allows `//` as a comment\nmarker, provided code for the `--no3` and `--stdin-name`\noptions, counting the m4 language,\nand suggested several user-interface enhancements.\n\nMichael Bello provided code for the `--opt-match-f`,\n`--opt-not-match-f`,\n`--opt-match-d`, and `--opt-not-match-d`\noptions.\n\nMahboob Hussain inspired the `--original-dir` and\n`--skip-uniqueness` options, found a\nbug in the duplicate file detection logic and improved the JSP filter.\n\nRandy Sharo found and fixed an uninitialized variable bug for shell\nscripts having only one line.\n\nSteven Baker found and fixed a problem with the YAML output generator.\n\nGreg Toth provided code to improve blank line detection in COBOL.\n\nJoel Oliveira provided code to let `--exclude-list-file` handle\ndirectory name exclusion.\n\nBlazej Kroll provided code to produce an XSLT file, `cloc-diff.xsl`,\nwhen producing XML output for the `--diff` option.\n\nDenis Silakov enhanced the code which generates `cloc.xsl` when\nusing `--by-file` and `--by-file-by-lang` options, and\nprovided an XSL file that works with `--diff` output.\n\nAndy (awalshe@sf.net) provided code to fix several bugs:\ncorrect output of `--counted`\nso that only files that are used in the code count appear and\nthat results are shown by language rather than file name;\nallow `--diff` output from multiple runs to be summed\ntogether with `--sum-reports`.\n\nJari Aalto created the initial version of `cloc.1.pod` and\nmaintains the Debian package for cloc.\n\nMikkel Christiansen (mikkels@gmail.com) provided counter definitions\nfor Clojure and ClojureScript.\n\nVera Djuraskovic from [Webhostinggeeks.com](http://webhostinggeeks.com/)\nprovided the\n[Serbo-Croatian](http://science.webhostinggeeks.com/cloc)\ntranslation.\n\nGill Ajoft of [Ajoft Software](http://www.ajoft.com)\nprovided the\n[Bulgarian](http://www.ajoft.com/wpaper/aj-cloc.html)\ntranslation.\n\nThe\n[Knowledge Team](http://newknowledgez.com/)\nprovided the\n[Slovakian](http://newknowledgez.com/cloc.html) translation.\n\nErik Gooven Arellano Casillas provided an update to the MXML counter to\nrecognize ActionScript comments.\n\n[Gianluca Casati](http://g14n.info) created the\n[cloc CPAN package](https://metacpan.org/pod/App::cloc).\n\n\u003c!--- broken link\nMary Stefanova provided the\n[Polish](http://www.trevister.com/blog/cloc.html)\ntranslation. ---\u003e\n\nRyan Lindeman implemented the `--by-percent` feature.\n\nKent C. Dodds, [@kentcdodds](https://twitter.com/kentcdodd),\ncreated and maintains the npm package of cloc.\n\n[Viktoria Parnak](http://kudoybook.com)\nprovided the\n[Ukrainian](http://blog.kudoybook.com/cloc/)\ntranslation.\n\nNatalie Harmann provided the\n[Belarussian](http://www.besteonderdelen.nl/blog/?p=5426)\ntranslation.\n\nNithyal at [Healthcare Administration Portal](http://healthcareadministrationdegree.co/)\nprovided the\n[Tamil](http://healthcareadministrationdegree.co/socialwork/aldanial-cloc/)\ntranslation.\n\nPatricia Motosan\nprovided the\n[Romanian](http://www.bildelestore.dk/blog/cloc-contele-de-linii-de-cod/)\ntranslation.\n\n\u003c!--- broken link\nThe [Garcinia Cambogia Review Team](http://www.garciniacambogiareviews.ca/)\nprovided the\n[Arabic translation](http://www.garciniacambogiareviews.ca/translations/aldanial-cloc/). ---\u003e\n\nGajk Melikyan provided the\nprovided the\n[Armenian translation](http://students.studybay.com/?p=34)\nfor http://studybay.com.\n\n\u003ca href=\"http://www.forallworld.com/cloc-grof-sornyi-kodot/\"\u003eHungarian translation\u003c/a\u003e\ncourtesy of \u003ca href=\"http://www.forallworld.com/\"\u003eZsolt Boros\u003c/a\u003e.\n\n\u003ca href=https://github.com/stsnel\u003eSietse Snel\u003c/a\u003e implemented the parallel\nprocessing capability available with the \u003ctt\u003e--processes=\u003ci\u003eN\u003c/i\u003e\u003c/tt\u003e\nswitch.\n\nThe development of cloc was partially funded by the Northrop Grumman\nCorporation.\n\n[](1}}})\n\u003ca name=\"Copyright\"\u003e\u003c/a\u003e []({{{1)\n#   [Copyright \u0026#9650;](#___top \"click to go to top of document\")\nCopyright (c) 2006-2025, [Al Danial](https://github.com/AlDanial)\n[](1}}})\n","funding_links":["https://github.com/sponsors/AlDanial"],"categories":["Perl","Misc","Development","Applications","Other Tools","Command Line Utilities","Containers \u0026 Language Extentions \u0026 Linting","Measuring","others","其他","For Developers","Software / Web Service","\u003ca name=\"programming\"\u003e\u003c/a\u003eProgramming","Audit Scoping","Code"],"sub_categories":["Time Series","System tools","Bonus","Tools","For JavaScript","网络服务_其他","Directory Navigation","Others","Development","Cloc"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlDanial%2Fcloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlDanial%2Fcloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlDanial%2Fcloc/lists"}