HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
AlDanial
cloc
Perl2016–2026
AlDanial / cloc

cloc

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

34Distinct people
39Mentions
0Explicit recommenders
23.7KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

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

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 9–Nov 16 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/16/2026, 7:27:27 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year39 dated mentions

Observed mentions: 2016-04-18 20:21:59 UTC to 2026-01-07 21:52:30 UTC.

02462016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC413
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC303
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC202
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC404
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC312
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC615
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC716
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC716
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
cloc Count Lines of Code cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. Latest release: v2.10 (July 4, 2026) cloc moved to GitHub in September 2015 after being hosted at http://cloc.sourceforge.net/ since August 2006. Quick Start Step 1: Install cloc (see Install from Github Releases and Install via package manager) or run cloc's docker image. The Windows executable has no requirements. The source version of cloc requires a Perl interpreter, and the Docker version of cloc requires a Docker installation. Step 2: Open a terminal (cmd.exe on Windows). Step 3: Invoke cloc to count your source files, directories, archives, or git commits. The executable name differs depending on whether you use the development source version (cloc), source for a released version (cloc-2.10.pl) or a Windows executable (cloc-2.10.exe). On this page, cloc is the generic term used to refer to any of these. Include Security has a YouTube video showing the steps in action. a file prompt> cloc hello.c 1 text file. 1 unique file. 0 files ignored. https://github.com/AlDanial/cloc v 1.65 T=0.04 s (28.3 files/s, 340.0 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 1 0 7 5 ------------------------------------------------------------------------------- a directory prompt> cloc gcc-5.2.0/gcc/c 16 text files. 15 unique files. 3 files ignored. https://github.com/AlDanial/cloc v 1.65 T=0.23 s (57.1 files/s, 188914.0 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 10 4680 6621 30812 C/C++ Header 3 99 286 496 ------------------------------------------------------------------------------- SUM: 13 4779 6907 31308 ------------------------------------------------------------------------------- an archive We'll pull cloc's source zip file from GitHub, then count the contents: prompt> wget https://github.com/AlDanial/cloc/archive/master.zip prompt> cloc master.zip https://github.com/AlDanial/cloc v 1.65 T=0.07 s (26.8 files/s, 141370.3 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Perl 2 725 1103 8713 ------------------------------------------------------------------------------- SUM: 2 725 1103 8713 ------------------------------------------------------------------------------- a git repository, using a specific commit This example uses code from PuDB, a fantastic Python debugger. prompt> git clone https://github.com/inducer/pudb.git prompt> cd pudb prompt> cloc 6be804e07a5db 48 text files. 41 unique files. 8 files ignored. github.com/AlDanial/cloc v 1.99 T=0.04 s (1054.9 files/s, 189646.8 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Python 28 1519 728 4659 reStructuredText 6 102 20 203 YAML 2 9 2 75 Bourne Shell 3 6 0 17 Text 1 0 0 11 make 1 4 6 10 ------------------------------------------------------------------------------- SUM: 41 1640 756 4975 ------------------------------------------------------------------------------- each subdirectory of a particular directory Say you have a directory with three different git-managed projects, Project0, Project1, and Project2. You can use your shell's looping capability to count the code in each. This example uses bash (scroll down for cmd.exe example): prompt> for d in ./*/ ; do (cd "$d" && echo "$d" && cloc --vcs git); done ./Project0/ 7 text files. 7 unique files. 1 file ignored. github.com/AlDanial/cloc v 1.71 T=0.02 s (390.2 files/s, 25687.6 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- D 4 61 32 251 Markdown 1 9 0 38 make 1 0 0 4 ------------------------------------------------------------------------------- SUM: 6 70 32 293 ------------------------------------------------------------------------------- ./Project1/ 7 text files. 7 unique files. 0 files ignored. github.com/AlDanial/cloc v 1.71 T=0.02 s (293.0 files/s, 52107.1 lines/s) ----------------------------
Read the full README on GitHub

What Hacker News says

6 sources
Currently vendoring all of the dependencies for Rust implementation pulls in 1.75 million SLOC, which I find amusing. This is a lot of SLOC, and a huge surface area to pull targeted supply-chain attacks, IMO. P.S.: I know you don't compile in all of this into the binary, yet consider the eyes and work hours required to verify that the whole chain is sane and safe. This is how it looks: vagrant@rust-playground:~/development/sudo-rs$ cloc . 3549 text files. 3271 unique files. 453 files ignored. 1 error: Line count, exceeded timeout: ./vendor/proc-macro2/src/parse.rs github.com/AlDanial/cloc v 1.86 T=9.67 s (320.2 files/s, 208065.8 lines/s) -------------------------------------------------------------------------------- Language
Read the rest
files blank comment code -------------------------------------------------------------------------------- Rust 2637 49276 111413 1754298 diff 2 884 32618 35892 Markdown 182 4903 9 13341 TOML 137 807 1073 5734 Assembly 8 90 71 1244 YAML 5 80 26 393 JSON 106 0 0 120 reStructuredText 1 70 4 90 C/C++ Header 9 5 2 79 Bourne Shell 5 14 17 64 C 2 6 6 46 Bourne Again Shell 2 7 8 41 Python 1 17 19 38 Dockerfile 1 0 0 2 -------------------------------------------------------------------------------- SUM: 3098 56159 145266 1811382 --------------------------------------------------------------------------------
In Testing the memory safe Rust implementation of Sudo/Su

Show HN: Cloc as a Service

Hey HN, I wanted to show you my weekend(s) project: cloc[0] as a Service. I'm learning golang and wanted to have a real project so I decided to build this over the curse of some weekends. I know there are websites that analyze repositories and spit out way more information, but nonetheless here's my attempt. The page is entirely written in golang (and html without any framework) and uses cloc to count the lines of code in the repository. It's hosted on fly.io and uses Redis as a cache to store the results. It doesn't yet work for larger repositories because there's a 60 second timeout in fly's webproxy and I cannot program goroutines yet. :) Also for non-existing repos it just throws an error. I also "implemented" an API, so you can just run: curl -X POST https://clocaas.fly.dev/repo?name=dev-sec%2Fansible-collection-hardening and ge
Read the rest
t the results on the cli. Let me know what you think. :) 0: https://github.com/AlDanial/cloc
1 points · Open discussion
When I started making a game [0] last year, first thing I did was write a little Unity script that takes a screenshot of the opening scene, counts current lines of code using CLOC [1] (for fun, not as a true measure of anything), and occasionally renders it all out to an image file. With that I'm able to create some pretty fun time lapses of progress. I've been doing this at an arbitrary milestone, whenever my Luau [2] LOC surpasses C++ by another factor. This post reminded me I'm overdue for another now that Luau > 3x C++ LOC. I find it rewarding to look back at my progress. I'll share in case it's interesting for you too [3]. [0] https://store.steampowered.com/app/2168330/Helmscape/ [1] https://github.com/AlDanial/cloc [2] https://luau-lang.org [3] https://twitter.com/kineticpoet/status/1619508466212831232
In Take more screenshots (2022)
It's strange that the Fuchsia homepage says that it is written in 'C', when wikipedia says it's written in 'C, C++, Dart, Go, Rust, Python'. I've counted the number of lines in the fuchsia codebase myself using `cloc .` and the results are below. It is not written in solely C or even mostly C. In fact there are more lines of code written in Rust. The fuchsia team should rectify this incorrect information on their homepage. Why is the implementation language even listed as the first thing on the homepage? It's really odd. $ cloc . 69394 text files. 66754 unique files. 22781 files ignored. 14 errors: Line count, exceeded timeout: ./scripts/third_party/d3_v3/d3.js Line count, exceeded timeout: ./src/diagnostics/archivist/src/inspect/mod.rs Line count, exceeded timeout: ./src/lib/diagnosti
Read the rest
cs/selectors/src/parser.rs Line count, exceeded timeout: ./src/proc/tests/android/gvisor/expectations/default.json5 Line count, exceeded timeout: ./src/settings/service/src/light/light_controller.rs Line count, exceeded timeout: ./third_party/golibs/vendor/golang.org/x/net/idna/tables10.0.0.go Line count, exceeded timeout: ./third_party/golibs/vendor/golang.org/x/net/idna/tables11.0.0.go Line count, exceeded timeout: ./third_party/golibs/vendor/golang.org/x/net/idna/tables12.0.0.go Line count, exceeded timeout: ./third_party/golibs/vendor/golang.org/x/net/idna/tables13.0.0.go Line count, exceeded timeout: ./third_party/golibs/vendor/golang.org/x/net/idna/tables9.0.0.go Line count, exceeded timeout: ./third_party/gvisor_syscall_tests/expects/netstack3/loopback_expectations.cc Line count, exceeded timeout: ./third_party/gvisor_syscall_tests/expects/netstack3/tcp.json5 Line count, exceeded timeout: ./third_party/rust_crates/vendor/tuf-0.3.0-beta11/src/metadata.rs Line count, exceeded timeout: ./tools/auto_owners/src/main.rs github.com/AlDanial/cloc v 1.90 T=142.47 s (328.0 files/s, 107722.2 lines/s) --------------------------------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------------------------------- JSON 2186 50 0 4674452 Rust 13783 404572 625522 3339090 C++ 10232 402599 236729 1937881 Go 3227 91268 152628 671742 C/C++ Header 8236 174436 243376 619602 Markdown 3717 108561 72 318674 Assembly 447 35435 18812 293467 C 1591 47081 64048 271343 CSV 17 0 0 140374 Dart 637 10788 11546 61906 Python 424 11559 13427 47039 Perl 41 5210 4997 38375 diff 4 960 33038 36364 TOML 734 3762 5518 21375 YAML 326 976 1555 19767 JavaScript 68 3340 10315 19305 Bourne Shell 286 3536 5394 16504 Bourne Again Shell 230 2882 4408 14259 SVG 72 66 362 11872 GLSL 57 2551 5322 7493 HTML 29 614 39 7344 JSON5 109 303 2199 6100 XML 42 468 172 5258 Protocol Buffers 35 1214 1746 3007 Bazel 37 325 299 2367 reStructuredText 9 538 152 1034 Starlark 20 192 418 856 Handlebars 38 123 8 838 Mako 8 70 0 537 make 16 100 34 371 JSX 2 13 31 250 vim script 10 72 124 232 CMake 4 44 123 227 Lisp 6 81 99 217 Dockerfile 18 42 30 211 Pascal 3 50 68 209 CSS 8 26 16 190 Jinja Template 3 16 0 175 Qt 1 0 0 156 Meson 5 27 18 98 Fish Shell 2 18 43 92 awk 1 14 3 80 Windows Module Definition 1 7 0 46 HLSL 2 6 0 38 Qt Project 1 11 3 31 DOS Batch 1 3 0 20 INI 2 2 0 16 Nix 1 1 0 6 --------------------------------------------------------------------------------------- SUM: 46729 1314012 1442694 12590890 ---------------------------------------------------------------------------------------
In Google Fuchsia OS team affected by layoffs
> What do you mean by "heavyweight"? Rails latest release (7.0.4) have 386,970 lines of code in total, 310,779 of it being Ruby code. 3000 files in total. Just the `lib` directory of `activerecord` has 33,036 lines of code, across 369 files. By most metrics, RoR is pretty heavyweight, as their literal taglines are "Ruby on Rails scales from HELLO WORLD to IPO" and "A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern", so it needs to be pretty big to support those use cases. Full `cloc` report in case someone is curious: 4268 text files. 3839 unique files. 511 files ignored. github.com/AlDanial/cloc v 1.96 T=1.25 s (3079.1 files/s, 434339.6 lines/s) ---------------------------------------------------------
Read the rest
---------------------- Language files blank comment code ------------------------------------------------------------------------------- Ruby 3013 73152 54669 310779 Markdown 92 19324 388 45525 JavaScript 87 2974 2170 20955 YAML 171 406 350 3679 CSS 23 347 152 2409 ERB 386 303 9 2244 CoffeeScript 12 97 125 413 JSON 11 7 0 372 HTML 21 15 3 200 Bourne Shell 2 20 25 167 Text 7 0 0 51 yacc 1 4 0 46 SQL 1 6 0 43 Dockerfile 1 7 7 40 SVG 7 0 1 36 builder 3 1 0 10 DTD 1 0 0 1 ------------------------------------------------------------------------------- SUM: 3839 96663 57899 386970 -------------------------------------------------------------------------------
In Ask HN: Who’s using Ruby for web development, without Ruby on Rails?

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.